nemo_gym.orchestration.executors.script_templates
nemo_gym.orchestration.executors.script_templates
Module Contents
Functions
Data
RAY_SERVE_QUEUE_LENGTH_RESPONSE_DEADLINE_S
RAY_SYMMETRIC_RUN_CLUSTER_WAIT_TIMEOUT_S
API
Make body safe to embed inside a single-quoted bash -c '...' block.
POSIX shells do not nest single quotes: an inner quote ENDS the outer string
rather than nesting in it. Every value that had to be quoted — a Hydra
override containing a space, or any of the JSON blobs vLLM flags take
(--hf-overrides '{"architectures":[...]}') — would otherwise break out of
the block and word-split. Both failure modes have been observed on real
submissions: Hydra rejecting +multistage.stages=[{num_tasks: on its own,
and /usr/bin/env: Argument list too long from a multi-node vLLM command
whose JSON flags reopened the quoting.
'"'"' is the standard end-quote / literal-quote / reopen-quote sequence.
It leaves $VAR and $(( )) untouched, which matters: the inner shell is
the one meant to expand them.
Render the srun entrypoint for the driver step.
When either gym_install or prepare is needed, wraps everything in a single bash -c so prepare and run happen in the same srun step and container.
Render a bash array with each argument on its own line.
host is emitted verbatim so it may be a shell expansion: a service pinned to
a node pool answers on that pool’s head, not on the node running this script.
Render an &&-chained command that installs git if missing, then clones and checks out ref.
dest is emitted verbatim so it may be a shell expression (the driver passes
"$GYM_SRC/gym" to clone outside the job directory); omit it to clone into a
directory named after the repo in the current one.
Render the Ray head/worker bootstrap that wraps a single vLLM instance’s TP/PP command so it spans multiple Slurm nodes.
Uses ray symmetric-run when available (Ray >= 2.50), which starts/joins a Ray cluster across
every task and runs the entrypoint only on the elected head node. Containers with an older Ray
pin fall back to manually starting head/worker Ray processes, keyed on Slurm’s per-node task
rank ($SLURM_NODEID).
Render a command that reconstructs content at dest_path via a base64 round-trip.