Work is pushed to the grid, and an idle grid costs one claim per wrapper per timeout
Table of Contents
1. Summary
Work reaches a wrapper; a wrapper does not poll for it. The server publishes a notice when it adds work for a platform. An idle wrapper waits for the notice and claims when it arrives, and the claim takes one job under a lease. A wrapper also claims after a long timeout, measured in minutes, which covers a lost notice. Between those it sends nothing, so an idle grid runs one claim per wrapper per timeout and nothing else.
2. Detail
2.1. The notice
The notice is a core NATS message on the platform's work subject. It holds no state; it tells the wrappers of that platform that a claim can succeed. A lost notice costs at most the long timeout.
2.2. The claim
A claim takes the oldest runnable job of the platform with FOR UPDATE SKIP
LOCKED, leases it to the wrapper and mints its token, as
How the compute grid queues and claims work describes. Several wrappers woken by one notice race; the lock decides
which one takes the job, and the others find none and wait again.
2.3. After a job
A wrapper that finishes a job claims again at once, because work may be waiting, and waits for a notice only when a claim finds nothing.
3. Patterns used
- Competing Consumers — the wrappers of a platform compete for its jobs, and the lock decides each one.
4. See also
- The data path — the structure note that orders this cluster.
- Compute job lifecycle — the life of a job from batch to result.