Repository navigation
Conversation
Add cortage jobs: a linked chain of jobs that run back-to-back on a single runner with a shared, un-cleaned ci/tmp, so the critical path pays the per-job overhead (queue wait, boot, clone/checkout, artifact download) only once. - job.py: attach_to() + attached_to/promote_runs_on fields - validator.py: validate_cortages (engine/fork/cycle/deadlock asserts, runs_on + stray-promote warnings) - workflow.py: cortage chain helpers - orchestrator: head-only dispatch to the effective pool, members monitored via their own keys, ordering-only sequential edge (req: independent members still run) - job_runner.py: in-process chain walk with resume-skip, block-skip, external-dep stall, per-member final.json - controller Heartbeat: follows a per-member pointer file so member heartbeats keep instance_id/attempt - runner.py: reuse an earlier member's artifact from the shared ci/tmp, else S3 - settings.py: CORTAGE_MAX_STALL_SEC (15 min) - docs/cortage-jobs.md + docs/proposals/cortage-jobs.md Bump praktika to 0.1.32; advance baked base wheel to 0.1.31. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Workflow [PR Prev Version], commit [cb6d9b0] Summary: ❌
|
- kick: dispatch a member as the chain entry when no earlier member was dispatched (e.g. cache/filter-skipped head), instead of unconditionally suppressing all non-head members. run_job drives the chain from the dispatched entry. (rerun of a middle member left as a TODO) - job_runner: skip Config-Workflow cache/filter-SKIPPED members instead of re-running them - job_runner: resume-skip now restores the skipped member's environment for the next member - _wait_external_deps: honor a dep's non_blocking flag (success-equivalent), matching get_ready - stall timeout now publishes a terminal failure for the member (avoids a long liveness-timeout hang) and fails the chain Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…g failures - get_ready: the cortage ordering-only edge is now recorded in _cortage_pred ONLY when the member does not also explicitly depend on its predecessor (requires/run_after, incl. via an artifact). When it does, the predecessor stays a normal data dep so a failed predecessor cascade-cancels the member (matching the runner's block-skip). - _run_cortage_chain: block downstream members only on a BLOCKING failure; a member whose Result sets do_not_block_pipeline_on_failure is success-equivalent (matches get_ready), so its dependents still run (_is_blocking_failure). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kick suppressed a member whenever an earlier member had ever been dispatched (SUCCESS included), so a partial re-run of a middle member was stranded QUEUED (the original driver is long gone). Now a member is also dispatched when it is the earliest reset member of a re-run (rerun_count bumped, chain predecessor not part of the re-run); the runner resumes the chain from it. _reset_job already deletes the reset members' final.json, so the resuming runner re-runs them while resume-skipping the still-green ones. No heartbeat-grace needed: a completed chain has no live driver to double-run against. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…path AI review round 3: - job_runner resume now skips ANY already-finalized member (success OR failure), not just rc==0: never re-runs one the orchestrator already finalized; restores its environment; and re-records a blocking failure so its dependents stay block-skipped (matches cascade). A re-run still deletes final.json (_reset_job) so reset members do re-run. - runner._pre_run reuses an earlier member's artifact by its configured artifact.path (real provenance), copying it to INPUT_DIR, instead of trusting a same-basename file in INPUT_DIR; compressed artifacts fall through to S3. Also includes in-progress native-job cortage linking (cortage_links / attach_to then=...) in job.py, mangle.py, native_jobs.py, validator.py and the advanced workflow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hovering the timeline widget now draws a vertical guide line at the pointer and a floating "+Nh Mm Ss" label showing the elapsed offset for that column, computed from the same scaleX the bars use. Drawn on the canvas only, so it never reflows the page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a "cortages" key to the summary result ext (next to job_requires), built from Workflow.Config.get_cortage_chains() as ordered [head, ..., tail] job-name lists. Lives on the summary so it survives per-job report updates; empty when no cortages are declared. In the timeline widget, hovering any row now highlights the whole cortage it belongs to: a faint teal row tint, a left-edge accent bar per member, and a connector joining the members in row order. The tooltip lists the chain in execution order with the hovered member marked. Drawn on the canvas only, so it never reflows the page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ining attach_to can pull Praktika-native jobs (Config Workflow, the Docker builds) in as predecessors from a single member via an ordered list; mangle applies those deferred cortage_links once the native jobs are injected. Validation is now shared and authoritative: - Extract _cortage_structural_errors (existence, self-attach, fork, attach-cycle, dependency deadlock) and run it both pre-mangle in the validator (native names allowed as targets) and post-mangle in mangle, where the fully materialized graph is visible. This closes the gap where forks and dependency cycles introduced through native jobs or cortage_links were invisible to the pre-mangle validator (AI review finding). - Reject attaching to a native job that was not actually injected in this workflow (e.g. a Docker build with no workflow.dockers), which previously crashed later resolving the chain runs_on (AI review finding). - Reject Finish Workflow as a cortage member: it is the orchestrator-owned summarizer and must run after every job is finalized, so colocating it races the orchestrator and mis-stamps jobs NOT_FINALIZED. Document the accepted limitation that a cortage is a single trust domain: members share one gh credential store with no cleanup between them, so once any member sets enable_gh_auth every later member can use that token. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| _write_hb_pointer(member_task["heartbeat_s3_key"], phase="running_job") | ||
|
|
||
| rc = _run_single( | ||
| member_task, workflow, member, gh_token=gh_token, local=False, timestamp=timestamp |
There was a problem hiding this comment.
Blocking: a failed final-state publication does not stop the chain
_run_single logs when all five final.json PUT attempts fail but still returns the job's original rc. This loop then advances to later members, and handle_task ultimately acknowledges the SQS message even if the subprocess returns nonzero. The orchestrator never finalizes the missing member, while later jobs may already have run and produced side effects before eventually being stranded behind it. Final-state publication failure must be surfaced as an infrastructure failure that prevents further chain execution and causes redelivery, or otherwise guarantee a terminal state before advancing.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Returning None on ANY exception conflated 'final.json absent' (member not finalized -> run it) with a transient/permission S3 error while it exists, which on resume would re-run an already-finalized member and repeat its side effects. Now only a confirmed missing key (NoSuchKey/404, via _is_missing_s3_key_error) returns None; other errors retry with backoff and, if still failing, raise to abort the chain rather than silently re-run. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| # runner resumes the chain from it; later reset members are then | ||
| # covered by that new driver and stay suppressed. | ||
| pred = chain[idx - 1] if idx > 0 else None | ||
| is_rerun_entry = self.rerun_count > 0 and ( |
There was a problem hiding this comment.
Blocking: a live rerun can launch a second chain driver
apply_rerun permits resetting a terminal member while independent later members of the same cortage are still QUEUED/RUNNING; those nonterminal members are not included in the reset cascade. This branch immediately dispatches the reset member as a fresh entry even though the original driver is still walking the tail. When the new driver reaches an in-flight later member, its final.json is not present yet, so _load_final returns None and the job executes concurrently a second time, duplicating side effects and racing final-state writes. Defer the rerun until the existing driver has left the chain, transfer ownership, or ensure the new driver cannot execute non-reset members that are already in flight.
| except Exception: | ||
| cortage_produced = {} | ||
| for artifact, prefix in zip(required_artifacts, prefixes): | ||
| if artifact._provided_by in cortage_predecessors and not artifact.compress_zst: |
There was a problem hiding this comment.
Blocking: compressed artifacts fall back to a double-suffixed S3 path
All cortage members reuse the same in-memory workflow and Artifact.Config objects. A compressed producer's _post_run mutates artifact.path to the generated .zst path. This branch deliberately excludes that artifact from local reuse, so the later consumer reaches the existing compressed-download path, which appends .zst to the already-mutated value and requests something like foo.zst.zst. Compressed artifacts between chain members therefore fail even though the documented fallback is S3. Preserve the original configured path/avoid mutating the shared config, or reconstruct independent artifact configs for each member.
…g pending Short members (run back-to-back on the shared runner) often finished before the 30s heartbeat landed, so their check went PENDING->terminal, never RUNNING. - kick posts a suppressed member's check as in_progress right away, adopting the chain driver's instance_id (all members share one runner); internal status stays QUEUED so the pickup-timeout still guards a member the driver never reaches. - controller Heartbeat now polls the pointer on a short tick and beats immediately when it flips to a new member, so a sub-interval member still gets a heartbeat under its own key (prompt QUEUED->RUNNING with the real runner id). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
scale_coefficient=1.0 (one instance per queued/in-flight task, closing the backlog in one autoscaler iteration) and capacity_reserve=3 so a warm runner is ready for the cortage head/members. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| handed off from the previous member. check_run_id is dropped (the orchestrator | ||
| owns the member's check; the job just loses a self-link).""" | ||
| norm = _normalize_job_name_for_s3(member_name) | ||
| member_task = dict(task) |
There was a problem hiding this comment.
Blocking: later members inherit the entry's rerun metadata
dict(task) copies the dispatched entry's rerun_count and run_attempt_started_at, but these are per-JobState values and can differ across a rerun cascade due to earlier independent reruns. For example, if A has previously rerun twice and B once, resetting both makes their counts 3 and 2; an A-driven chain gives B count 3 and A's cutoff. _build_ci_environment then exposes the wrong RUN_ATTEMPT/RUN_ATTEMPT_STARTED_AT, which can change rerun test selection and CIDB attribution, and B's final.json records the wrong count. Populate these fields from the member's authoritative state/task metadata rather than cloning them from the entry.
runner.py: pass --ignore-submodules=dirty to the before/after-job "git status --short" repo-state notes. The bare command runs a nested status in every submodule work tree (159 submodules / ~700k files), adding 40-75s to each build job's final step and delaying every dependent test job (upstream ecc23fe5ce64). The flag still reports all superproject changes and any submodule whose checked-out commit moved; nothing parses these notes. pools: raise DEFAULT_SCALE_COEFFICIENT 0.3 -> 0.8 so autoscaled pools close most of the demand gap each iteration, and give OrchestratorPool its own validated scale_coefficient (0, 1]. Plus praktika.html tweaks and S3_PROXY_HARDENING / orchestrator-poll-latency notes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
WAIT_POLL_INTERVAL_S becomes a Settings knob (default 2s) and the cortage external-dep stall loop reuses it instead of a hardcoded 10s, cutting DAG-handoff latency on the critical path. Documents both poll knobs in orchestrator-poll-latency.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The git history fetches in Config Workflow are now off by default and gated on Workflow.Config.ext["enable_git_history"], shaving ~1s of wallclock off every run. Repos that need full git history (author lists, pre-merge commit messages, base-branch diffing) opt in via the ext flag. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
_prepare_submodule_cache ran `git submodule update --depth=1 --single-branch --jobs 8`. `--jobs` parallelizes only the shallow clones; fetching each pinned commit the default-branch clone lacks and its checkout run one submodule at a time in a serial loop, which is the bulk of the time on a cache miss. Fan out per submodule with `xargs --max-procs=8` instead, as the build/fast-test jobs do (upstream 98598ba4d1f8). ~3x faster on a full miss (309s -> ~110s), identical .git/modules. Plumbing already present locally (Digest._get_submodules, Shell.check stdin_str). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
Adds cortage jobs: a linked chain of jobs that run back-to-back on a single runner with a shared, un-cleaned
ci/tmp. The goal is to put the workflow's critical path in a cortage so the fixed per-job overhead (queue wait, runner boot, repo clone/checkout, artifact download/upload) is paid once - later members start instantly on the warm runner and read the previous member's output straight fromci/tmp.Native engine only (
GH_ACTIONSgives each job its own runner, so colocation is meaningless - rejected by the validator).Configuration
See
docs/cortage-jobs.md(feature doc) anddocs/proposals/cortage-jobs.md(design).How it works
attach_to()builder +attached_to/promote_runs_onfields.validate_cortages- engine/fork/attach-cycle/deadlock-cycle errors; runs_on-mismatch + stray-promote warnings.state.json, each member writes its ownfinal.json).instance_id+ SQS attempt (liveness/retry unchanged).ci/tmp, else fall back to S3.CORTAGE_MAX_STALL_SEC(15 min).Also bumps praktika to 0.1.32 and advances the baked base wheel to 0.1.31.
Testing
Unit tests pass for the orchestrator/validator/runner changes. The job_runner chain loop + controller heartbeat-pointer need validation on a live runner (SQS/S3) - not yet exercised end-to-end on AWS.
🤖 Generated with Claude Code