Skip to content

feat: add print_script option to SlurmExecutor#465

Open
ko3n1g wants to merge 2 commits intomainfrom
ko3n1g/feat/print-slurm-script-to-stdout
Open

feat: add print_script option to SlurmExecutor#465
ko3n1g wants to merge 2 commits intomainfrom
ko3n1g/feat/print-slurm-script-to-stdout

Conversation

@ko3n1g
Copy link
Contributor

@ko3n1g ko3n1g commented Mar 15, 2026

Summary

  • Adds print_script: bool = False field to SlurmExecutor
  • When True, the generated sbatch script is printed to stdout after materialization in _submit_dryrun(), for both dryrun and real submissions
  • Enables users to inspect, copy-paste, or pipe the script directly to sbatch without the NeMo Run dependency

Motivation

Currently dryrun=True logs the script via the Rich console, but there is no clean way to get plain text to stdout for scripting. This option makes it easy to reproduce a job standalone:

executor = SlurmExecutor(..., print_script=True)
run.run(task, executor, dryrun=True)  # prints sbatch script to stdout

or pipe directly:

python my_job.py | sbatch

Test plan

  • test_submit_dryrun_print_script — verifies #!/bin/bash appears in stdout when print_script=True
  • test_submit_dryrun_no_print_by_default — verifies stdout is empty when print_script=False (default)
  • Full test suite passes: uv run -- pytest test/

🤖 Generated with Claude Code

Add `print_script: bool = False` field to `SlurmExecutor`. When `True`,
the generated sbatch script is printed to stdout after materialization in
`_submit_dryrun()`, enabling users to copy-paste or pipe the script
directly to `sbatch` without the NeMo Run dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: oliver könig <okoenig@nvidia.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: oliver könig <okoenig@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant