Skip to content

Write submission records with job ids - #568

Open
nsheff wants to merge 1 commit into
devfrom
feat/submission-records
Open

nsheff wants to merge 1 commit into
devfrom
feat/submission-records

Conversation

@nsheff

@nsheff nsheff commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Today looper throws away the job id that the scheduler prints when it submits a job (for example Submitted batch job 12345 from sbatch). So once looper exits, there is no easy way to find, check on, or cancel the jobs it started, or to pick up after a crash.

With this PR, every real submission (not dry runs) writes a small JSON file next to its .sub script, <job_name>.submission.json. It holds the job id, the samples, the pipeline, the compute package, the submit command, the time, what the submit command printed, and its return code. A rerun overwrites the file with the latest submission.

  • The job id is found with a new compute package setting, job_id_regex. The default divvy config sets it for the SLURM and SGE packages, and looper picks a default for sbatch, qsub and bsub when it is not set. Set it to null to turn it off.
  • Local runs (no scheduler) get a record too, with the process id instead of a job id. Their output still streams to the terminal as before.
  • The file is written to a temporary file and then renamed into place, so a tool reading it while looper runs never sees half a file.

There is also an optional provenance feature, off by default. With --record-environment (or record_environment: true in the compute settings, so a divvy package, the pipeline interface or --compute can turn it on), the record also lists the container images the job used (docker, apptainer, or the images in a bulker crate) and their digests, so you can tell later exactly which software ran. It only looks at what is already on the machine; it never pulls images or contacts a registry, and if something cannot be found it is simply left out.

Tests: unit and integration suites pass, ruff is clean. Docs and the changelog entry will come in a separate PR to master, where the docs live.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T11:26:59.996429Z cdced73 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cdced73c5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread looper/conductor.py
"""
job_id = None
if stdout and regex:
match = re.search(regex, stdout, re.MULTILINE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate job-id regexes before launching the submit command

When a scheduler package supplies a syntactically invalid job_id_regex, this call occurs only after the submission process has completed, so the scheduler may already have accepted the job before re.error escapes. Looper then writes no record, leaves its pool/tallies unfinalized, and reports a failure that can prompt the user to resubmit the same work; compile the regex before Popen or handle parsing errors as a record warning.

Useful? React with 👍 / 👎.

Comment thread looper/conductor.py
Comment on lines +164 to +165
command = os.path.basename(compute["submission_command"].split()[0])
return JOB_ID_REGEXES.get(command)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Match sbatch's parsable output

When a custom compute package uses the common submission_command: sbatch --parsable without an explicit regex, this selects the normal Submitted batch job ... pattern solely from the executable name. SchedMD documents that --parsable outputs only the job ID and optional cluster name, so every successful submission in this configuration produces job_id: null; select a parsable-aware pattern such as one matching the leading numeric ID.

Useful? React with 👍 / 👎.

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