Scheduler domain

The scheduler reads these options before it runs a checklet. The generated entries below describe their types, lookup locations, and defaults.

Preflight rules

momotor.options.domain.scheduler.preflight.PREFLIGHT_OPTION

The preflight@scheduler option allows recipes to indicate situations in which the checklet does not have to be executed.

preflight@scheduler option

A preflight check handled by the scheduler. This allows recipes to indicate situations in which the step does not have to be executed.

See Scheduler preflight option for the documentation of this option.

Type:

string

Required:

False

Multiple:

True

All:

True

Location:

config, recipe, step

Default:

No default

momotor.options.domain.scheduler.preflight.LABEL_OPTION

Label copied to preflight results when no label property is supplied.

label option

Label for a generated preflight result. Supports task id placeholders.

Type:

string

Required:

False

Multiple:

False

Location:

config, recipe, step

Default:

No default

See Scheduler preflight option for rule syntax and result scope.

Task counts

momotor.options.domain.scheduler.tasks.TASKS_OPTION

The tasks@scheduler option defines the number of sub-tasks for a step.

tasks@scheduler option

Enable multiple tasks for this step. If not provided, a single task is generated for this step.

See Scheduler tasks option for the documentation of this option.

Type:

string

Required:

False

Multiple:

False

Location:

config, recipe, step

Default:

No default

See Scheduler tasks option for allowed dimensions and wildcard definitions.

Tool requirements

momotor.options.domain.scheduler.tools.TOOLS_OPTION

The tools@scheduler option defines the tools required for a step.

tools@scheduler option

List of tools required for the step. Can only be provided by <step> nodes.

Multiple tools can be provided by using multiple tools@scheduler options, or using a single tools@scheduler option with multiple tool names. Multiple tool names on a single option should be space or comma separated.

The list of tools should only contain tool names. Any detailed version requirements should be defined with options in the tools domain.

See the tool registry documentation on how this option is used to resolve a tool.

Type:

string

Required:

False

Multiple:

True

All:

False

Location:

step

Default:

No default

See Tools domain for version alternatives and Tool registry for lookup.

Scheduler API

momotor.options.domain.scheduler.preflight.preflight_check(providers)

Evaluate preflight@scheduler rules in order.

The first matching rule determines the result. A matching run action returns None. Unless a rule uses an error reference, the default %any error => skip-error rule runs first.

Outcome references inspect all of providers.results. Recipe dependency declarations do not limit their scope. For example, %all skip[#evaluate.*] checks only the available results whose ids match evaluate.*.

Parameters:

providers (Providers) – Bundles and current task used for option and result lookup.

Return type:

ResultsBundle | None

Returns:

A generated results bundle, or None when the checklet should run.

Raises:

ValueError – If a rule, action, reference, or provider is invalid.

momotor.options.domain.scheduler.preflight.create_preflight_result(providers, trigger, action, status)

Create a result bundle for a matched preflight action.

Status text supports reference placeholders. A status starting with { is parsed as a JSON object. Invalid JSON produces a warning and a plain status property. Action properties override status properties. The result also has preflight-trigger and source properties and copies the current step’s options when available.

Parameters:
  • providers (Providers) – Bundles and current task. A task id is needed for label lookup.

  • trigger (str) – Complete matched rule, stored in preflight-trigger.

  • action (tuple[Outcome, dict]) – Outcome and additional properties from PREFLIGHT_ACTIONS.

  • status (str | None) – Plain status text, JSON object text, or None.

Return type:

ResultsBundle | None

Returns:

A results bundle containing one preflight result.

Raises:

ValueError – If placeholder expansion or label lookup fails.

momotor.options.domain.scheduler.tasks.get_scheduler_tasks_option(recipe, config, step_id)

Resolve task counts for a step and validate them against its definition.

The unqualified tasks@scheduler definition comes from recipe options, then step options. Concrete counts come from scheduler#<step-id> in config, then recipe. Fixed definitions can supply the counts themselves.

Parameters:
  • recipe (RecipeBundle) – Recipe containing the step and allowed task dimensions.

  • config (ConfigBundle | None) – Optional configuration containing task counts.

  • step_id (str) – Step whose task counts are requested.

Return type:

Sequence[int] | None

Returns:

Counts per dimension, or None for a step without separate tasks.

Raises:

momotor.bundles.BundleFormatError – If the definition is invalid, required counts are missing, counts do not match, or counts are supplied for a step without a definition.

momotor.options.domain.scheduler.tools.get_scheduler_tools_option(recipe, config, results, *, task_id)

Resolve the tool requirements for one step and task.

The step’s tools@scheduler options list requirement names. Options in the Tools domain supply alternative registry names, with config, step, then recipe precedence. Reference placeholders can use results from earlier tasks.

Each requirement maps to a frozenset of alternatives, which does not preserve preference order. If alternatives have different base tool names, only those matching the requirement name are kept. A single shared base name can differ from the requirement name, allowing aliases such as python-legacy.

Parameters:
Return type:

Mapping[str, Set[str | PathLike | ToolName]]

Returns:

Requirement names mapped to sets of acceptable tool names.

Warns UserWarning:

If alternatives with non-matching base names are discarded.

Raises: