orxtra v0.13.0 /scheduler.src.orxtra.scheduler._loader
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

python
def _parse_postchecks(raw: dict[str, Any]) -> list[Execution]

Convert TOML postchecks section to list of Execution objects.

#_parse_task

python
def _parse_task(raw: dict[str, Any]) -> TaskSpec

Parse a single task dict from TOML into a TaskSpec.

#_document_text

python
def _document_text(source: Path | str) -> str

Return the TOML text for a file path or a raw TOML string.

#_gate_document

python
def _gate_document(text: str, source: Path | str) -> None

Run 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

python
def _validate_dependencies(dependencies: dict[str, list[str]], task_names: set[str]) -> None

Validate that all dependency references exist.

#load_workflow

python
def load_workflow(source: Path | str) -> WorkflowConfig

Load 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.
Search