> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/gym/_mcp/server.

# nemo_gym.orchestration.executors.slurm_script

## Module Contents

### Functions

| Name                                                                                                | Description                                                                                        |
| --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| [`_build_ray_command`](#nemo_gym-orchestration-executors-slurm_script-_build_ray_command)           | -                                                                                                  |
| [`_build_vllm_command`](#nemo_gym-orchestration-executors-slurm_script-_build_vllm_command)         | -                                                                                                  |
| [`_render_directives`](#nemo_gym-orchestration-executors-slurm_script-_render_directives)           | -                                                                                                  |
| [`_render_pool_directives`](#nemo_gym-orchestration-executors-slurm_script-_render_pool_directives) | -                                                                                                  |
| [`_render_service_command`](#nemo_gym-orchestration-executors-slurm_script-_render_service_command) | -                                                                                                  |
| [`_resolve_env`](#nemo_gym-orchestration-executors-slurm_script-_resolve_env)                       | Return an 'env K=V ...' prefix string (trailing space) scoped to a single command, or '' if empty. |
| [`_validate_env_key`](#nemo_gym-orchestration-executors-slurm_script-_validate_env_key)             | -                                                                                                  |
| [`build_sbatch_script`](#nemo_gym-orchestration-executors-slurm_script-build_sbatch_script)         | -                                                                                                  |

### Data

[`_BUILDERS`](#nemo_gym-orchestration-executors-slurm_script-_BUILDERS)

[`_SCRIPT_TEMPLATE`](#nemo_gym-orchestration-executors-slurm_script-_SCRIPT_TEMPLATE)

[`_VALID_ENV_KEY`](#nemo_gym-orchestration-executors-slurm_script-_VALID_ENV_KEY)

### API

```python
nemo_gym.orchestration.executors.slurm_script._build_ray_command(
    _service: nemo_gym.orchestration.api.RayServiceConfig
) -> str
```

```python
nemo_gym.orchestration.executors.slurm_script._build_vllm_command(
    service: nemo_gym.orchestration.api.VllmServiceConfig
) -> str
```

```python
nemo_gym.orchestration.executors.slurm_script._render_directives(
    compute: nemo_gym.orchestration.api.SlurmComputeConfig,
    remote_bench_dir: pathlib.Path,
    benchmark_name: str
) -> str
```

```python
nemo_gym.orchestration.executors.slurm_script._render_pool_directives(
    pool_name: str,
    pool: nemo_gym.orchestration.api.NodePool
) -> list[str]
```

```python
nemo_gym.orchestration.executors.slurm_script._render_service_command(
    name: str,
    container: str,
    command: str,
    env: dict[str, str] | None = None,
    mounts: list[str] | None = None
) -> str
```

```python
nemo_gym.orchestration.executors.slurm_script._resolve_env(
    env: dict[str, str]
) -> str
```

Return an 'env K=V ...' prefix string (trailing space) scoped to a single command, or '' if empty.

```python
nemo_gym.orchestration.executors.slurm_script._validate_env_key(
    key: str
) -> None
```

```python
nemo_gym.orchestration.executors.slurm_script.build_sbatch_script(
    config: nemo_gym.orchestration.api.SubmitConfig,
    benchmark_name: str,
    benchmark: nemo_gym.orchestration.api.BenchmarkRunConfig,
    compute: nemo_gym.orchestration.api.SlurmComputeConfig,
    remote_bench_dir: pathlib.Path
) -> str
```

```python
nemo_gym.orchestration.executors.slurm_script._BUILDERS = {VllmServiceConfig: _build_vllm_command, RayServiceConfig: _build_ray_command}
```

```python
nemo_gym.orchestration.executors.slurm_script._SCRIPT_TEMPLATE = '#!/bin/bash\n{directives}\n\n{service_commands}\n\n{health_checks}\n\n{prepare_...
```

```python
nemo_gym.orchestration.executors.slurm_script._VALID_ENV_KEY = re.compile('^[A-Za-z_][A-Za-z0-9_]*$')
```