On this page
load_workflow parses a workflow TOML file or string into a WorkflowConfig: gates the document through the strictspec validator, then parses tasks, pre/postchecks, services, and dependencies.
#scheduler.src.orxtra.scheduler._loader
#scheduler.src.orxtra.scheduler._loader
#WorkflowValidationError
A workflow document failed strictspec validation at the load boundary.
Subclasses ValueError so existing except ValueError handlers keep working. Carries the rendered strictspec diagnostics.
#_parse_postchecks
def _parse_postchecks(raw: dict[str, Any]) -> list[Execution]Convert TOML postchecks section to list of Execution objects.
#_parse_task
def _parse_task(raw: dict[str, Any]) -> TaskSpecParse a single task dict from TOML into a TaskSpec.
#_document_text
def _document_text(source: Path | str) -> strReturn the TOML text for a file path or a raw TOML string.
#_gate_document
def _gate_document(text: str, source: Path | str) -> NoneRun the strictspec document gate at the load boundary.
The generated validator enforces the document shape (required [workflow] name/description, at least one task, per-task field types, unknown-key rejection) and the intra-document constraints (exactly-one execution mode, agent-mode co-presence, conditional-required retry and for_each fields, depends_on reference resolution). A failing document is a hard error. This subsumes the former hand-rolled _validate_structure and the execution-mode/agent/conditional shape checks. Cross-document and graph-shaped checks (top-level dependency-map resolution, DAG acyclicity, variable collisions, headless mode) stay consumer-native downstream.
#_validate_dependencies
def _validate_dependencies(dependencies: dict[str, list[str]], task_names: set[str]) -> NoneValidate that all dependency references exist.
#load_workflow
def load_workflow(source: Path | str) -> WorkflowConfigLoad a workflow from a TOML file path or TOML string.
Args:
source: A Path to a .toml file, or a raw TOML string.
Returns:
- Parsed and validated WorkflowConfig.
Raises:
ValueError: If the TOML is invalid or fails validation.