Skip to content

Dispatch a job's iterations one execution at a time - #1582

Open
epompeii wants to merge 1 commit into
u/ep/experiment/iterationfrom
u/ep/experiment/dispatch
Open

epompeii wants to merge 1 commit into
u/ep/experiment/iterationfrom
u/ep/experiment/dispatch

Conversation

@epompeii

@epompeii epompeii commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

The server now sends a remote job 1 run at a time: each Job message carries 1 iteration, and the server forms the iterations.

Every runner in the fleet already reads a message of 1 iteration correctly, so runners do not change and the wire gains no field.

How

  • job_execution: 1 row per run sent to a runner, with its own UUID, the job, the report, the iteration, the runner, the budget it was sent, a status (Sent, Running, Completed, Failed, Canceled, Unknown), and its times.
  • The message: the Job message's uuid is the execution's UUID, which the runner echoes in its result, so a late or resent result names its execution exactly. iter is 1, the timeout is the job's remaining budget, and each execution gets its own pull token.
  • The claim: priority first, then the job whose last execution was sent longest ago (a new job counts as the oldest), then age. A job has at most 1 execution in flight (Sent, Running, or Unknown), so its iterations run one after another, on any runner of its spec, and another job's execution can go between them.
  • The tiers keep their meaning: a Free or Unclaimed job between iterations is still in progress and holds its organization.
  • Results: each execution's output is stored when it arrives; the job's output is assembled and processed once, when every iteration has its outcome.
  • --allow-failure: a run that exits non-zero, or that reports no result, is skipped and stores nothing, as in a local run. Without it, such a run fails the job.
  • A Failed message always fails the job, even with --allow-failure: a pull that fails, a run out of time, or a runner that stops. So a job whose image cannot be pulled still fails, as before.
  • The timeout and billing count only the time inside the job's own executions, rounded up once at the end. A job that runs out of budget before its next iteration fails and names how many iterations ran.
  • A silent runner: its execution goes Unknown, and the job gets nothing more; a result resent within that execution's budget plus the grace period still lands.
  • Atomicity: a failed or canceled execution and the end of its job commit in 1 transaction, and ending a job cancels its executions in flight in the same transaction.
  • Recovery: a restart keeps finished executions, marks only executions in flight as Unknown, and leaves a job between executions running. A job in flight at the deploy gets 1 execution that covers all of its runs, so a runner mid-job completes it.
  • --iter 0 now runs once, where it waited forever before.
  • Docs: the runner protocol pages in 9 languages describe 1 execution per message and the summed timeout; the glossary gains Execution and Iteration.

Tests

Integration tests over the runner WebSocket with an injectable clock: 3 messages for 3 iterations; a resend lands on its own execution; the order between jobs and tiers; each tier runs 1 execution of a job at a time, and a Plus job takes another runner while a Free job runs; a Free job holds its organization; --allow-failure gaps; the shrinking budget; a silent runner within and past its budget, and one whose job status did not follow; billing of 3 short executions is 1 minute; a restart between executions; no claim between a failed execution and its job's end; fault injection that shows each end of a job commits as 1 transaction; a Failed under --allow-failure fails the job. Tests that hold an execution without heartbeats run with a long heartbeat timeout, so a slow CI machine cannot time them out. The smoke test's build time check matches the runner's records by the job's time window, since the runner now logs each execution's UUID. A real, unchanged runner completed a job of --iter 3 through 3 messages against a local API.

@epompeii
epompeii added this pull request to stack #1583 November 25, 2026 03:47
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

ProjectBencher
Branchu/ep/experiment/dispatch
Testbedintel-v1
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
Adapter::Json📈 view plot
🚷 view threshold
5.32 µs
(+2.30%)Baseline: 5.20 µs
5.48 µs
(97.11%)
Adapter::Magic (JSON)📈 view plot
🚷 view threshold
5.11 µs
(+1.54%)Baseline: 5.03 µs
5.29 µs
(96.56%)
Adapter::Magic (Rust)📈 view plot
🚷 view threshold
26.51 µs
(-1.24%)Baseline: 26.85 µs
28.64 µs
(92.56%)
Adapter::Rust📈 view plot
🚷 view threshold
4.65 µs
(+4.10%)Baseline: 4.47 µs
4.69 µs
(99.18%)
Adapter::RustBench📈 view plot
🚷 view threshold
4.62 µs
(+3.61%)Baseline: 4.46 µs
4.69 µs
(98.62%)
🐰 View full continuous benchmarking report in Bencher

@epompeii
epompeii force-pushed the u/ep/experiment/dispatch branch from ca060c2 to 64ddcd2 Compare November 25, 2026 23:00
@epompeii
epompeii marked this pull request as ready for review November 25, 2026 23:32
@epompeii
epompeii marked this pull request as draft November 26, 2026 13:42
@epompeii
epompeii force-pushed the u/ep/experiment/dispatch branch from 64ddcd2 to 5f6cb69 Compare November 26, 2026 23:05
@epompeii
epompeii force-pushed the u/ep/experiment/dispatch branch from 5f6cb69 to b7c52e7 Compare December 1, 2026 19:07
The server now sends a runner one run of a job's image per message and
forms the job's iterations itself. Each run is recorded, so iterations
of one job can run on different runners and interleave with other jobs,
and the timeout and billing count only the time inside the job's own
runs.
@epompeii
epompeii force-pushed the u/ep/experiment/dispatch branch from b7c52e7 to 33368f9 Compare December 2, 2026 23:07
@epompeii
epompeii marked this pull request as ready for review December 3, 2026 00:30

This branch has not been deployed

No deployments
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