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
TaskRefthat the supervisor can execute (build_task)
§Also
RunnerRouterselects a runner for a given spec.BuildContextshared dependencies passed tobuild_task.RunIdis a default id format produced bybuild_run_id.
Required Methods§
Sourcefn supports(&self, spec: &TaskSpec) -> bool
fn supports(&self, spec: &TaskSpec) -> bool
Returns true if this runner can handle the given spec.
Sourcefn build_task(
&self,
spec: &TaskSpec,
ctx: &BuildContext,
) -> Result<TaskRef, RunnerError>
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§
Sourcefn build_run_id(&self, slot: &str) -> RunId
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.