Skip to main content

Runner

Trait Runner 

Source
pub trait Runner: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn supports(&self, spec: &TaskSpec) -> bool;
    fn build_task(
        &self,
        spec: &TaskSpec,
        ctx: &BuildContext,
    ) -> Result<TaskRef, RunnerError>;

    // Provided method
    fn build_run_id(&self, slot: &str) -> RunId { ... }
}
Expand description

Generic task runner used by the core layer.

A runner is responsible for:

  • deciding whether it can handle a given TaskSpec (supports)
  • building a concrete TaskRef that the supervisor can execute (build_task)

§Also

Required Methods§

Source

fn name(&self) -> &'static str

Runner name used in logs and diagnostics.

Source

fn supports(&self, spec: &TaskSpec) -> bool

Returns true if this runner can handle the given spec.

Source

fn build_task( &self, spec: &TaskSpec, ctx: &BuildContext, ) -> Result<TaskRef, RunnerError>

Build a concrete TaskRef for the given spec.

The provided BuildContext carries shared dependencies injected at router setup time. Slot is extracted from spec.slot.

Provided Methods§

Source

fn build_run_id(&self, slot: &str) -> RunId

Builds a default run id for a given slot.

Runners may override this if they need custom id format, otherwise the core helper is used.

Implementors§