Track: Task models Runtime: Local Colab: Supported Estimated effort: approximately 30 minutes
After completing this lesson, you will be able to:
- invoke an importable Python function with structured inputs and outputs;
- explain the underlying mechanism;
- verify observed behavior and state what the evidence does not prove.
A mean-temperature calculation is clearer as a tested function than as a shell pipeline.
A native task targets module:function. JSON scalars bind directly; files may use workflow references; output parameters map below outputs/.
New terms are collected in the glossary.
Read the authoritative example or structural check before running it. The canonical lifecycle is add_task(), optional explicit make_dependencies() and Validate_WF() for inspection, then run(). run() constructs dependencies automatically when needed.
From the repository root:
python examples/tutorial/lesson_09_native_python_tasks.pyThe function writes JSON containing the exact mean.
python examples/tutorial/lesson_09_native_python_tasks.pyThe assertion checks result and import path.
DAGonStar constructed or inspected the graph, applied the selected staging and execution policy, and exposed evidence through task state, working directories, or exports. Files and exit status are observed evidence; broader portability and scientific validity require the controls stated here.
Rename the target function, predict whether failure occurs at construction or execution, then restore it.
Run from repository root. Lambdas and nested functions are not importable targets. See troubleshooting.
Pure deterministic functions with explicit interfaces are easier to test and reproduce.
Native tasks preserve structured bindings within a task execution boundary.
Next, send a structured request to a local service. Return to the syllabus at any time.