Scheduler is responsible for managing and scheduling the execution order of steps in the Recipe.
Summary
Types
Initial parameters can be a list of Params or a map of Params.
Functions
Initialize scheduler context.
Batch update configuration (at runtime).
Mark those steps that have started running(or remove when failed).
After the Step is executed, merge the result back into the Context.
Core scheduling function: Identify all the steps that are "inputs params ready" and "not executed".
Types
@type initial_params() :: [Orchid.Param.t()] | Orchid.Scheduler.Context.param_map()
Initial parameters can be a list of Params or a map of Params.
Functions
@spec build( Orchid.Recipe.t() | [Orchid.Step.t()], initial_params(), Orchid.WorkflowCtx.t() ) :: {:ok, Orchid.Scheduler.Context.t()} | {:error, term()}
Initialize scheduler context.
@spec done?(Orchid.Scheduler.Context.t()) :: boolean()
@spec get_results(Orchid.Scheduler.Context.t()) :: Orchid.Scheduler.Context.param_map()
@spec inject_opts( Orchid.Scheduler.Context.t(), (Orchid.Step.t() -> boolean()), keyword() ) :: Orchid.Scheduler.Context.t()
Batch update configuration (at runtime).
This is used in scenarios where after an external service crashes and re-assigned, but several steps' options still use the old references.
@spec mark_running_steps( Orchid.Scheduler.Context.t(), Orchid.Scheduler.Context.step_index() | [Orchid.Scheduler.Context.step_index()], mode :: :running | :reattempt ) :: Orchid.Scheduler.Context.t()
Mark those steps that have started running(or remove when failed).
@spec merge_result( Orchid.Scheduler.Context.t(), non_neg_integer(), [Orchid.Param.t()] | Orchid.Param.t() ) :: Orchid.Scheduler.Context.t()
After the Step is executed, merge the result back into the Context.
@spec next_ready_steps(Orchid.Scheduler.Context.t()) :: [ {Orchid.Step.t(), Orchid.Scheduler.Context.step_index()} ]
Core scheduling function: Identify all the steps that are "inputs params ready" and "not executed".