Skip to content

Fix two chain-killing bugs in the PBS self-scheduling recipe - #211

Merged
OwenPriceSkelly merged 1 commit into
mainfrom
fix-pbs-chain-recipe
Aug 12, 2026
Merged

Fix two chain-killing bugs in the PBS self-scheduling recipe#211
OwenPriceSkelly merged 1 commit into
mainfrom
fix-pbs-chain-recipe

Conversation

@OwenPriceSkelly

Copy link
Copy Markdown
Member

Summary

Two latent bugs in scripts/nightly_smoke_test.pbs meant every PBS chain ran exactly one generation, then died silently — generation 2 crashed before its payload and never scheduled generation 3.

Bug 1 — self-path breaks at generation 2. The script located itself via $PBS_O_WORKDIR, which is only the submit directory for the first, human-submitted generation. For a job submitted by another PBS job, PBS_O_WORKDIR is the parent job's cwd — $HOME, since PBS starts jobs there and the script never cds. Generation 2's qsub of the bogus $HOME/... path fails, and set -euo pipefail kills the job before the smoke-test runs. Fix: each generation passes the path down explicitly with qsub -v SELF_PATH=...; the existing ${SELF_PATH:-...} default already honors the override. CLUSTER rides along in the same -v, since PBS doesn't propagate the environment down the chain and shared installs (sophia/polaris) need it on every generation — previously it would have silently reverted to the manifest default from generation 2 on. -v passes only the listed variables, so nothing else about the job environment changes.

Bug 2 — duplicate-chain guard never matched. The guard used qselect ... -s Q, but a job submitted with -a sits in state W (waiting), not Q, so the guard was a no-op. Fix: -s QW.

Also corrects the guidance that went with them, in the script header and docs/nightly-smoke-testing.md:

  • Stopping a chain: look for the waiting (W) job, not a queued (Q) one.
  • Fast end-to-end test: override RESCHEDULE_AT (via qsub -v) so generation 1 schedules generation 2 a few minutes out — that exercises the actual handoff. The previously suggested qsub -a <time> on the kickoff only delays generation 1's own start and tests nothing about the chain.

The SLURM sibling (nightly_smoke_test.sbatch) is unaffected: it recovers its path from scontrol show job and SLURM propagates the submit environment by default.

Test plan

  • bash -n on the edited script.
  • The fixed pattern (explicit -v SELF_PATH handoff + QW guard) is lifted from a sibling self-scheduling chain script developed against ALCF; the running Sophia/Polaris chains will be re-kicked-off with per-cluster copies of this fix, which exercises the generation 1 → 2 handoff for real.

🤖 Generated with Claude Code

Two latent bugs in scripts/nightly_smoke_test.pbs broke every PBS chain
at generation 2 (found while building a sibling chain script):

1. SELF_PATH derived from PBS_O_WORKDIR is wrong for any job submitted
   BY another PBS job: the child's PBS_O_WORKDIR is the parent job's
   cwd, which is $HOME (PBS starts jobs there and the script never
   cd's). So generation 2 pointed at $HOME/nightly_smoke_test.pbs, its
   qsub failed, and set -euo pipefail killed the job before the
   smoke-test ran — one generation, then a silent death. Fix: each
   generation now hands the next one its location explicitly via
   qsub -v SELF_PATH=... (the existing ${SELF_PATH:-...} default
   already honors the override). CLUSTER rides along too, since PBS
   doesn't propagate the environment down the chain and shared installs
   need it on every generation.

2. The duplicate-chain guard queried qselect -s Q, but a job submitted
   with -a sits in state W (waiting), not Q, so the guard never matched
   anything. Fix: -s QW.

Also corrects the docs/header guidance that went with them: look for
the waiting (W) job when stopping a chain, and fast-test the handoff by
overriding RESCHEDULE_AT — qsub -a on the kickoff only delays
generation 1's start and tests nothing about the chain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@OwenPriceSkelly
OwenPriceSkelly merged commit b01a629 into main Aug 12, 2026
5 checks passed
@OwenPriceSkelly
OwenPriceSkelly deleted the fix-pbs-chain-recipe branch August 12, 2026 18:48
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