Skip to content

Don't HTML-escape SlurmTemplate scripts - #649

Merged
ko3n1g merged 1 commit into
NVIDIA-NeMo:mainfrom
rioyu123:codex/slurm-shell-template
Oct 16, 2026
Merged

ko3n1g merged 1 commit into
NVIDIA-NeMo:mainfrom
rioyu123:codex/slurm-shell-template

Conversation

@rioyu123

@rioyu123 rioyu123 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Summary

SlurmTemplate renders inline and absolute-path templates with from_string() under select_autoescape(["html", "xml"]), which escapes string templates by default. The generated shell script ends up with HTML entities: quotes become &#39; and &#34;, and &, < and > become &amp;, &lt; and &gt;. Bash then runs a different command than the one written, often without reporting an error.

This sets default_for_string=False, so these templates now render exactly as written. That matches bundled relative templates, which are rendered through fill_template without escaping. How the command and template variables are quoted is unchanged.

Tests

Local results (Linux, Python 3.11):

  • New tests: four cases covering inline and absolute-path templates. They check that the rendered script keeps the setup line and the command verbatim, and that running it with bash -c prints the expected quoted value.
  • test_launcher.py: 4 failed / 16 passed before the fix, 20 passed after.
  • Full suite: 1716 passed, 1 deselected, 1 xfailed. After the summary, Ray prints an ignored atexit ray.dag import error; unmodified main prints the same message.
  • ruff check and ruff format --check pass. Not tested on a Slurm cluster.

Signed-off-by: Rio Yu <52408936+rioyu123@users.noreply.github.com>
@copy-pr-bot

copy-pr-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Oct 11, 2026
@ko3n1g

ko3n1g commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

/ok to test 839ea45

@ko3n1g

ko3n1g commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

/review

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No merge-blocking defects found. The rendering change disables implicit HTML escaping for inline and absolute-path shell templates while leaving command assembly and relative-template rendering unchanged. The regression tests cover both template sources, literal preservation of commands and variables, and quoted-command execution.

Static review only; tests were not executed in this read-only environment.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex

@ko3n1g
ko3n1g added this pull request to the merge queue Oct 16, 2026
Merged via the queue into NVIDIA-NeMo:main with commit 6599615 Oct 16, 2026
31 checks passed
@rioyu123

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @ko3n1g! Glad to see this and #650 both merged.

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Oct 16, 2026

This branch was previously deployed

1 inactive deployment
public — 839ea450 Deployed Oct 16, 2026 by copy-pr-bot[bot] via release / finalize / publish-docs #421
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants