Orchid.Scheduler (Orchid v0.6.1)

Copy Markdown View Source

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

initial_params()

@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

build(recipe, initial_params, workflow_context)

@spec build(
  Orchid.Recipe.t() | [Orchid.Step.t()],
  initial_params(),
  Orchid.WorkflowCtx.t()
) ::
  {:ok, Orchid.Scheduler.Context.t()} | {:error, term()}

Initialize scheduler context.

done?(context)

@spec done?(Orchid.Scheduler.Context.t()) :: boolean()

get_results(context)

get_results(context, key)

inject_opts(ctx, selector, new_opts)

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.

mark_running_steps(ctx, step_indices, mode \\ :running)

Mark those steps that have started running(or remove when failed).

merge_result(ctx, step_idx, output_params)

After the Step is executed, merge the result back into the Context.

next_ready_steps(ctx)

Core scheduling function: Identify all the steps that are "inputs params ready" and "not executed".