m3resp.load_spec#
- m3resp.load_spec(spec, *, root=None)[source]#
Load a workflow from an object, dictionary or YAML/JSON file.
- Parameters:
spec (str | Path | dict[str, Any] | WorkflowSpec) – A WorkflowSpec returned as supplied, a dictionary to parse, or a file path. Files ending in .json use JSON parsing; other files use yaml.safe_load. Versioned specs receive strict format validation.
root (str | Path | None) – Base directory for relative paths within a parsed spec. Defaults to the file’s parent directory for a file, or the current working directory for a dictionary. An existing WorkflowSpec retains its root.
- Returns:
- Ordered steps, raw parameter references and workflow
settings. The root is normalized and outputs.dir is resolved against it. Operation names and bindings are checked during compilation.
- Return type:
- Raises:
WorkflowSpecError – If a document is not a mapping, its schema version is unsupported, format validation fails, or step IDs are duplicated.
OSError – If a file cannot be read.
json.JSONDecodeError – If a JSON file is malformed.
yaml.YAMLError – If a YAML file is malformed.