Skip to main content

Module chain

Module chain 

Source
Expand description

Jobs that run one after another.

A pipeline — transcribe, then detect the moments, then render each — is a chain: the next step is dispatched when the one before it succeeds, and a step that fails for good ends the chain there. The steps are ordinary jobs; nothing about a job knows it is in a chain except the context it is handed, which carries the chain’s id so progress can be reported against the whole.

ⓘ
queue.dispatch_chain(
    Chain::new(Transcribe { video })
        .then(DetectMoments { video })
        .then(RenderClips { video }),
).await?;

A failed step stops the chain, and the remaining steps go to the dead-letter table with it, so what did not run is visible rather than silently gone. Retries happen within the step, with the step’s own policy; the chain only advances on success.

Structs§

Chain
A sequence of jobs.