Skip to content

Add job dependency chaining (depends_on) - #7

Merged
krokicki merged 5 commits into
mainfrom
job-dependencies
Jul 28, 2026
Merged

krokicki merged 5 commits into
mainfrom
job-dependencies

Conversation

@krokicki

@krokicki krokicki commented Jul 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a depends_on option to submit()/submit_array() so a job starts only after all its dependency jobs succeed, and is auto-cancelled if any dependency fails. Motivated by the org-wide LSF survey (tensorswitch's hand-rolled bsub -K/bwait coordinator scripts; twocof's raw -w 'ended(...)').

  • API: depends_on: Sequence[JobRecord | str] | None on both submit methods; resolved ids stored on JobRecord.depends_on. Fan-in supported via the list form. Fully backward compatible (optional kwarg + defaulted field).
  • LSF: native bsub -w "done(a) && done(b)" -ti — chains live in the scheduler, survive client restarts, and LSF terminates orphaned dependents itself (no jobs stuck PEND forever).
  • Local: poll-driven deferred start — dependent jobs park as PENDING with a synthetic waiting-N id and spawn when deps finish; killed with metadata["dependency_failed"] if a dep fails.
  • Base poll: annotates metadata["dependency_failed"] so on_failure callbacks can distinguish upstream failure from the job's own.

Design spec: docs/superpowers/specs/2026-07-24-job-dependency-chaining-design.md (in base PR #6's branch)

Test plan

  • pixi run check — 175 passed, lint clean
  • Mocked LSF tests assert exact -w/-ti args (single, fan-in, array, default-absent)
  • Real-subprocess local tests: chain success, dep-failure kill, fan-in, dependent array, cancel-while-parked
  • Run integration tests

@StephanPreibisch @dchen116

krokicki and others added 5 commits July 27, 2026 19:39
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tion

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Live integration run currently blocked: the cluster rejects the local
test config's '#BSUB -P scicompsoft' project (pre-existing; all
integration tests fail the same way until tests/cluster_config.yaml
gets a valid -P project).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@krokicki
krokicki changed the base branch from pid-as-job-id to main July 28, 2026 00:19
@krokicki
krokicki merged commit 29a58b2 into main Jul 28, 2026
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