Expand description
Async ML job queue — FIFO queue + worker pool + job-state registry.
Callers submit() a job and get back an MlJobId immediately.
Worker threads pick jobs off the queue, invoke the caller-supplied
MlWorkFn to perform the actual work, and record progress +
terminal status back into the queue’s job table.
Cancellation is cooperative: setting a job to MlJobStatus::Cancelled
flips a flag that the worker polls between checkpoints. Workers
that never check the flag cannot be forcibly killed — this is a
deliberate trade-off (no unsafe thread termination, clean up is
the algorithm’s responsibility).
Structs§
- JobHandle
- Handle passed into an
MlWorkFn. The worker uses it to report progress and observe cancellation — no other mutations are possible, which keeps contracts small. - MlJob
Queue - Queue + worker pool pair. Safe to clone — every clone shares the
underlying queue via
Arc.
Type Aliases§
- MlWork
Fn - Callback invoked on a worker thread to perform the actual work.