Skip to content

Commit b1af69e

Browse files
[pre-commit.ci] Add auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 7eda3e2 commit b1af69e

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

vec_inf/client/_slurm_script_generator.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,24 @@ def __init__(self, params: dict[str, Any]):
4444

4545
def _generate_env_str(self) -> str:
4646
"""Generate the environment variables string for the Slurm script.
47-
47+
4848
Returns
4949
-------
5050
str
5151
Formatted environment variables string for container or shell export commands.
5252
"""
5353
env_dict: dict[str, str] = self.params.get("env", {})
54-
54+
5555
if not env_dict:
5656
return ""
57-
57+
5858
if self.use_container:
5959
# Format for container: --env KEY1=VAL1,KEY2=VAL2
6060
env_pairs = [f"{key}={val}" for key, val in env_dict.items()]
6161
return f"--env {','.join(env_pairs)}"
62-
else:
63-
# Format for shell: export KEY1=VAL1\nexport KEY2=VAL2
64-
export_lines = [f"export {key}={val}" for key, val in env_dict.items()]
65-
return "\n".join(export_lines)
62+
# Format for shell: export KEY1=VAL1\nexport KEY2=VAL2
63+
export_lines = [f"export {key}={val}" for key, val in env_dict.items()]
64+
return "\n".join(export_lines)
6665

6766
def _generate_script_content(self) -> str:
6867
"""Generate the complete Slurm script content.

vec_inf/client/_slurm_templates.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,19 @@ class SlurmScriptTemplate(TypedDict):
114114
'head_node_ip=$(srun --nodes=1 --ntasks=1 -w "$head_node" hostname --ip-address)',
115115
"\n# Check for RDMA devices and set environment variable accordingly",
116116
"if ! command -v ibv_devices >/dev/null 2>&1; then",
117-
" echo \"ibv_devices not found; forcing TCP. (No RDMA userland on host?)\"",
117+
' echo "ibv_devices not found; forcing TCP. (No RDMA userland on host?)"',
118118
" export NCCL_IB_DISABLE=1",
119-
" export NCCL_ENV_ARG=\"--env NCCL_IB_DISABLE=1\"",
119+
' export NCCL_ENV_ARG="--env NCCL_IB_DISABLE=1"',
120120
"else",
121121
" # Pick GID index based on link layer (IB vs RoCE)",
122-
" if ibv_devinfo 2>/dev/null | grep -q \"link_layer:.*Ethernet\"; then",
122+
' if ibv_devinfo 2>/dev/null | grep -q "link_layer:.*Ethernet"; then',
123123
" # RoCEv2 typically needs a nonzero GID index; 3 is common, try 2 if your fabric uses it",
124124
" export NCCL_IB_GID_INDEX={{NCCL_IB_GID_INDEX:-3}}",
125-
" export NCCL_ENV_ARG=\"--env NCCL_IB_GID_INDEX={{NCCL_IB_GID_INDEX:-3}}\"",
125+
' export NCCL_ENV_ARG="--env NCCL_IB_GID_INDEX={{NCCL_IB_GID_INDEX:-3}}"',
126126
" else",
127127
" # Native InfiniBand => GID 0",
128128
" export NCCL_IB_GID_INDEX={{NCCL_IB_GID_INDEX:-0}}",
129-
" export NCCL_ENV_ARG=\"--env NCCL_IB_GID_INDEX={{NCCL_IB_GID_INDEX:-0}}\"",
129+
' export NCCL_ENV_ARG="--env NCCL_IB_GID_INDEX={{NCCL_IB_GID_INDEX:-0}}"',
130130
" fi",
131131
"fi",
132132
"\n# Start Ray head node",

0 commit comments

Comments
 (0)