Skip to content

feat: campaign.yaml, scheduler adapters and the GPU-partition lint (hpc-campaign p2a) - #1741

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/hpc-campaign-p2-campaign-core
Oct 30, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/hpc-campaign-p2-campaign-core

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

PR 2a of hpc-campaign phase 2 (#1740, epic ledger draft/research/autofit/hpc_campaign_epic.md). It adds a new autofit/campaign/ package (stdlib + PyYAML; nothing calls Slurm at import), its tests, and nothing else.

  • campaign.yaml loader and validator (spec.py):
    • stages and manifests (0-based line = array index), chunked to the site's max_array_size;
    • resources set through a single --mem-per-cpu knob;
    • per-index after: dependencies (aftercorr);
    • success: checks;
    • a propose-only retry policy (ruling F5);
    • the site: layer from PyAutoNerves site.yaml.
  • Scheduler protocol with three adapters:
    • FakeScheduler, for tests;
    • LocalScheduler, a subprocess pool;
    • SlurmScheduler: batched sacct/squeue/sinfo through an injectable runner, and sbatch with aftercorr, --kill-on-invalid-dep=yes, --mem-per-cpu, and --signal=B:USR1@600 forwarded to the fit.
  • Partition lint (hard constraint, lint.py): CPU-only work never goes on a GPU partition. It runs on validate, submit and every pending-job update. The timing-leg exemption needs all three of: ≤8 CPUs per task, a throttle of %2 or less, and no pending GPU jobs. If any of those is unknown, it refuses.
  • submit writes an atomic job ledger.
  • CLI: python -m autofit.campaign {validate,submit}.

Decisions taken (please check)

  1. Mixed lists are always refused. ral,gpu and gpu,ral are refused for CPU work even when the exemption conditions hold; the exemption only applies to a GPU partition on its own. This is stricter than the ledger's wording, and safe.
  2. Directives are read the way sbatch reads them: parsing stops at the first command, so a late #SBATCH --gpus cannot make a CPU job count as a GPU job.
  3. Array numbering: each chunk's array runs from 0, and the script exports CAMPAIGN_INDEX = CAMPAIGN_OFFSET + SLURM_ARRAY_TASK_ID. That keeps aftercorr aligned chunk by chunk.
  4. squeue/sinfo use classic -o format strings rather than -O.

Test plan

  • test_autofit/campaign (90 on this branch): spec validation, units, the lint matrix (every branch, ral,gpu and gpu,ral included), sacct parsing, Slurm golden sbatch text with an injected runner, submit, local scheduler, CLI, and a subprocess test that nothing runs at import.
  • Full PyAutoFit suite (see comment).

Refs #1740

🤖 Generated with Claude Code

…on lint (hpc-campaign p2a, #1740)

autofit.campaign: campaign.yaml loader/validator (stages, manifest chunks of at most the
site's max_array_size, one-knob --mem-per-cpu resources, per-index dependencies,
success checks, propose-only retry policy, the autonerves site layer); the Scheduler
protocol with FakeScheduler (tests), LocalScheduler (subprocess pool) and
SlurmScheduler (batched sacct/squeue/sinfo through an injectable runner; sbatch with
aftercorr, --kill-on-invalid-dep=yes, --mem-per-cpu, --signal=B:USR1@600 forwarded to
the fit); the partition lint, enforced on validate, submit and update_pending: CPU-only
work never goes on a GPU partition, mixed lists (ral,gpu / gpu,ral) always refused, the
timing-leg exemption only for <=8 CPUs, %<=2 and no pending GPU jobs, failing closed
when unknown; submit writes a job ledger; python -m autofit.campaign {validate,submit}.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Full PyAutoFit suite (PyAuto313, local): 2a 4,082 passed / 2b 4,098 passed (2 skipped, 1 xfailed). Smoke autofit (scripts + notebooks) green on the 2b head. Heart STALE (release validation only) acknowledged by the human for this ship.

@Jammy2211
Jammy2211 merged commit 14f7def into main Oct 30, 2026
5 checks passed
@Jammy2211
Jammy2211 deleted the feature/hpc-campaign-p2-campaign-core branch October 30, 2026 13:42
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