Execution and monitoring
Use this skill when an experiment must be launched, inspected, or recovered and backend choice or liveness semantics matter. It covers the execution boundary, not the research loop or provider/tool-selection policy.
Route first
- Read the
execution.modevalue and the monitor settings. - Select exactly one backend:
local,ssh, orslurm. - Validate required fields before launching anything. For
sshandslurm, controller state remains local while the tool-visible workspace and logs are remote. A Slurm login node is a submit/file-operation host, not a place to keep a watcher,tmux,srun --wait, or another persistent job process. - Pass command arguments as an argument vector at the backend boundary. Never
turn untrusted command text into a shell string. Treat
slurm_setupand extra scheduler directives as trusted operator configuration. - Record the returned
pidandlog_file; for Slurm,pidis the integer Slurm job id. Then use the zero-LLM monitor until a terminal decision.
See backends.md for constructors, factory fields, transport, path rules, and scheduler state mapping. See monitoring.md for the polling contract and result shape. See troubleshooting.md before retrying.
Configuration gate
The execution block uses these fields:
mode:local(default),ssh, orslurm.ssh_host,remote_workspace,remote_python(defaultpython3), andssh_args(default[]) for remote modes.- Slurm additionally requires
slurm_partitionandslurm_time; it acceptsslurm_gpus_per_job,slurm_gres,slurm_qos,slurm_account,slurm_setup,slurm_extra_sbatch,slurm_unknown_grace_polls, andslurm_time_buffer. monitor.poll_intervaldefaults to 900 seconds,monitor.zero_llmdefaults to true, andmonitor.notify_on_completedefaults to true.
Run the bundled read-only validator when changing these values:
python scripts/check_backend_config.py --config config.yaml
It does not connect, submit, launch, or write. Add --workspace-root DIR --path RELATIVE_PATH to check a path against a workspace, including symlink
escape detection.
Safe launch and monitor contract
The launch tool parses command text with shell-like quoting into argv, rejects
an empty command and a small set of destructive executable names, and delegates
with shell=False. Semicolons and pipes therefore remain ordinary argument
text; they do not create a second command. A log path is normalized and checked
before the backend creates its parent or opens it.
The monitor performs only backend PID/job liveness, a short log tail, and GPU
status while the job is alive. It makes no LLM call. On completion it reads up
to 50 log lines, extracts common loss, accuracy, FGD, FID, epoch, and
step values, and asks final_status() for the backend's terminal evidence.
status is failed only when success is explicitly false; otherwise it is
completed with success possibly unknown. Treat success: null as
indeterminate, not proof of successful training.
For Slurm, never reap a job while sacct reports PENDING or any running-bucket
state, even after slurm_time + slurm_time_buffer: queue time is not bounded by
--time. Only unconfirmed probes are bounded by consecutive unknown grace and
the wall-clock backstop. A confirmed Slurm FAILED, TIMEOUT, CANCELLED,
OUT_OF_MEMORY, or other failure state must remain failed and be carried into
state/ledger/reporting. A confirmed COMPLETED is the only Slurm success.
Recovery checklist
local: inspect the final log tail and rerun only after deciding whether the process ended normally; PID-only final status is inherently indeterminate.ssh: first verify host/workspace/helper reachability; retry transient SSH actions without changing the remote command. Do not create a remote watcher.slurm: distinguishPENDINGfrom unknown. Querysacctfirst; use its state as truth, and expect the monitor's bounded unknown handling only when accounting/transport cannot confirm the job. A job reaped by the backstop has unknown terminal state; reconcile the scheduler and log before calling it a success or resubmitting.- Any path error mentioning “escapes workspace” is a safety stop. Correct the relative path; do not weaken normalization or follow a symlink.
