Workers

Worker registration, the dispatch SSE channel, and operator-facing reads.

Worker routes split cleanly into two groups: endpoints the worker process calls into the server, and read-only endpoints for operators.

Worker-side endpoints all require worker:*:* (built into the worker role) and additionally check that the bearer-token identity matches the path {name} via _verify_worker_identity. Calling them from a normal admin token will return 403.

Operator-facing reads

GET /workers

List known workers from the in-memory cache.

GET /workers/{name}

Show one worker. Falls back to the database for workers that have disconnected but are still on record.

Worker-side endpoints

These are called by flux start worker against the server. Operators rarely call them directly; they are documented here for completeness and for anyone building a custom worker.

POST /workers/register

One-shot registration. The worker presents a bootstrap token (not an API key) in Authorization: Bearer <bootstrap_token>. If the configured [flux.workers].bootstrap_token is unset, the server auto-generates one on first start; surface it with flux server bootstrap-token.

GET /workers/{name}/connect

The dispatch SSE channel. Long-lived; the server pushes work to the worker through this stream.

The server tracks a per-worker connection generation; opening a new connect stream for the same name supersedes the old one.

POST /workers/{name}/claim/{execution_id}

Claim an execution the server just dispatched. Idempotent for re-claim attempts on the same worker; conflicts with claims from other workers return 409.

POST /workers/{name}/checkpoint/{execution_id}

Persist a state-transition checkpoint. Called after every ExecutionEvent the worker emits while running the workflow.

POST /workers/{name}/progress/{execution_id}

Forward task-progress events (from ctx.progress(...)) to any SSE stream subscribed to the execution. Drops events silently if no stream is listening or the buffer is full.

POST /workers/{name}/pong

Heartbeat acknowledgement. Called by the worker in response to ping events on its connect stream.

POST /workers/{name}/secrets/batch

Fetch secrets for an in-flight execution. The server enforces that the requested keys are declared in the workflow’s secret_requests metadata; undeclared keys cause a 403 listing the disallowed names.

Worker eviction

The server reaper marks workers as stale when pongs stop arriving for longer than the configured grace period, then evicts them. Eviction triggers the connect-stream coroutine to yield and close the SSE response. The worker is expected to reconnect with exponential backoff.