Repository navigation
feat(orchestration): add job-management interfaces and types - #5295
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP — LGTM — no concerns found.
Reviewed all 15 changed files and directly affected submit/resubmit, record-loading, log-rendering, and persistence paths. The capability refactor preserves supported Slurm resubmission and unsupported Kubernetes handling. The defaulted record field preserves legacy loading, and planned logs match the inspected service, Ray, prefill/decode, and telemetry rendering branches.
The declared-only job-management operations are consistent with this PR’s stated scope. Static review only; tests and Slurm execution were not run.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
a15e937 to
0fe7cf1
Compare
|
/ok to test 0fe7cf1 |
3ff2d12 to
bb0283c
Compare
|
Design note: recovery options and
Where the 17 options stand today. Kubernetes uses none, and only Slurm implements resubmit:
Main's recovery hooks ( Planned follow-up, its own PR after this stack lands (it rewrites main's recovery call paths, so it does not belong in a rebase): a typed |
86d3e42 to
7836130
Compare
Adds the types for job management (JobState, ObservedStatus, JobStatus, Failure, Progress, SubmissionStatus, JobRef, LogSource) in the executor-agnostic jobs module, and a defaulted BenchmarkJob.log_sources. The Slurm executor now plans each job's log sources with the same function that renders the job script's --output flags, and stores them in the record, so a reader can find a job's logs without listing the run directory. The generated job scripts are byte-identical. Co-Authored-By: Claude Opus 4.7 <[email protected]> Signed-off-by: Tomasz Grzegorzek <[email protected]>
…cutor Adds connection_key, query_states, terminate and stream_logs, which raise UnsupportedOperationError until an executor implements them, the optional read_run_files and read_progress with defaults, and log_sources, which reads the planned sources from the record. They are not abstract so that executors that only submit keep working. Co-Authored-By: Claude Opus 4.7 <[email protected]> Signed-off-by: Tomasz Grzegorzek <[email protected]>
…cutor Adds status, info, cancel, cancel_submission and logs to BaseExecutor with their contracts, and the JobInfo and BenchmarkInfo types info returns. Their bodies land with the logic in the following changes; cancel_submission takes its confirmation as a required keyword so a whole submission is never cancelled by accident. Signed-off-by: Tomasz Grzegorzek <[email protected]>
…lities BaseExecutor now requires only run. Resubmit, status, cancel and logs are opt-in capability interfaces (Resubmittable, Inspectable, Terminable, LogReadable) in executors/capabilities.py, with every method abstract so a capability cannot be half implemented. The job operations move off the executor into functions in operations.py that take an executor typed as the capability they need and import no executor module; a test enforces that. Slurm is Resubmittable; Kubernetes drops its raising resubmit stub and submit.resubmit reports the missing capability through require. Signed-off-by: Tomasz Grzegorzek <[email protected]>
BaseExecutor no longer imports BenchmarkJob, and the Kubernetes executor no longer imports UnsupportedOperationError; neither was a name the module defined. Signed-off-by: Tomasz Grzegorzek <[email protected]>
…pability Signed-off-by: Tomasz Grzegorzek <[email protected]>
Signed-off-by: Tomasz Grzegorzek <[email protected]>
Signed-off-by: Tomasz Grzegorzek <[email protected]>
…module The stats file path added on main uses LOGS_DIRNAME, which the log path helper had made unused here. Signed-off-by: Tomasz Grzegorzek <[email protected]>
7836130 to
e574c28
Compare
|
/ok to test e574c28 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44494130276 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44497328661 |
Summary
executors/capabilities.py).BaseExecutornow requires onlyrun. Each further feature is an opt-in interface:Resubmittable,Inspectable,Terminable(extendsInspectable),LogReadable(extendsInspectable). Every method of a capability is abstract, so one cannot be half implemented; the exceptions are two optional hooks that carry a default.require(executor, Capability, operation)returns the executor typed as the capability or raisesUnsupportedOperationError.SlurmExecutor(BaseExecutor, Resubmittable).KubernetesExecutor(BaseExecutor): its stub that raised forresubmitis gone, andsubmit.resubmitnow gets the sameUnsupportedOperationErrorfromrequire.operations.py):status,info,cancel,cancel_submissionandlogstake an executor typed as the capability they need. They are declared only and raiseNotImplementedErroruntil PR 2 or 3;log_sourcesis implemented. The module imports no executor, and a test enforces it.nemo_gym/orchestration/__init__.py.jobs.py:JobState,ObservedStatus,JobStatus,SubmissionStatus,JobInfo,Failure,Progress,JobRef,LogSource.BenchmarkJob.log_sources: the logs a job was set up to write, planned at submit. Defaulted, so old records load with[]andSCHEMA_VERSIONstays1.log_path(). The--outputflags and the newplanned_log_sources()both use it, so the plan cannot drift from the script.SlurmExecutor.runstores the plan on every benchmark.job-records.mdxdocuments the field.PR plan
Five PRs, Slurm only. Goal: status, cancel and logs for a submitted run without going to the scheduler.
statusandinfo, SlurmInspectable,gym job list,status,info.gym job cancelandgym job logs(--tail): the logic ofcancel,cancel_submissionandlogs, SlurmTerminableandLogReadable.gym eval submittells you what to type next.gym job resubmit;gym eval resubmitstays as a deprecated alias until 2026-11-23, with a test that fails then.Not in these five:
logs --follow, Kubernetes job management, progress, services declaring their own log sources.Interface design
listis offline;statusis the only command that queries the scheduler (no ids: the newest 10 submissions). Cancelling a whole submission needs its id typed.--benchmarkis strict with ids.What an executor implements:
BaseExecutorrun(config, *, dry_run=False) -> SubmissionRecord | Nonegym eval submitResubmittableresubmit(record, benchmark) -> BenchmarkJobgym job resubmitInspectableconnection_key(record) -> str,query_states(refs: list[JobRef]) -> dict[JobKey, ObservedStatus]; optional:read_run_files(record, paths) -> dict[Path, str | None],read_progress(record, job) -> Progress | Nonestatus,infoTerminable(Inspectable)terminate(record, job) -> NonecancelLogReadable(Inspectable)stream_logs(record, job, *, source: LogSource, tail, follow) -> Iterator[str]logsThe policy, in
operations.py:status(executor: Inspectable, records, benchmarks=None) -> list[SubmissionStatus]info(executor: Inspectable, record, benchmark=None) -> JobInfocancel(executor: Terminable, record, benchmark) -> JobStatuscancel_submission(executor: Terminable, record, *, confirm: str) -> list[JobStatus]logs(executor: LogReadable, record, benchmark, *, source="driver", instance=None, tail=None, follow=False) -> Iterator[str]log_sources(record, benchmark) -> list[LogSource]; reads the record, no executorLogSourceisname,kind(driverorservice),instance,location. On Slurm the location is a job-directory-relative path with a{job_id}placeholder.The operations call capability methods, never the other way round:
Validation
requirenames the executor and the operation, the optional hooks default to nothing,log_sourcesreads the record,cancel_submissioncannot be called withoutconfirm,operations.pyimports no executor (I checked it fails when it does), and the log plan. The plan test asserts the planned locations equal the--outputflags in the generated script, for five configs (plain, Ray with workers, prefill/decode, per-node, collector); it fails if the plan drifts.eval submitCLI): 608 passed, 2 failed. Both fail on cleanmainon macOS too (GNUsed -i).origin/main(sandbox, docker compose, harbor,super35launcher, CI-environment, telemetry, theopensandboxSlurm-eval tests, and the twosedtests above). An earlier run crashed with a pytestINTERNALERRORand was discarded.ruffand pre-commit pass.Known gaps
status,info,cancel,cancel_submissionandlogsare declared only: they raiseNotImplementedErroruntil PR 2 or 3.driveralready shares the driver's log file; the plan lists both.LogSource.instanceis alwaysNoneuntil services declare their instances.Rollout evidence
N/A: no agent, verifier or model behavior is touched.