Airflow TaskFlow API DAG
A decorator-based Airflow TaskFlow DAG where dependencies are implied by function calls rather than >> operators — the shape static DAG extractors most often get wrong. Every task returns a literal, so nothing performs I/O.
"""Airflow TaskFlow-API DAG definition. A PARSING fixture: decorator-based, so the task graph is
implied by function calls rather than by >> operators, which is the case static DAG extractors
most often get wrong. Nothing here performs I/O — every task returns a literal.
"""
from __future__ import annotations
import datetime as dt
from airflow.decorators import dag, task
@dag(
dag_id="orders_taskflow",
schedule="0 4 * * *",
start_date=dt.datetime(2026, 1, 1),
catchup=False,
tags=["orders", "taskflow", "example"],
)
def orders_taskflow() -> None:
@task
def extract() -> dict:
return {"rows": 1200, "source": "orders"}
@task
def transform(payload: dict) -> dict:
return {"rows": payload["rows"], "clean": True}
@task
def publish(payload: dict) -> str:
return f"published {payload['rows']} rows"
@task
def audit(payload: dict) -> str:
return f"audited {payload['rows']} rows"
extracted = extract()
transformed = transform(extracted)
publish(transformed)
audit(transformed)
orders_taskflow()
Specifications
- System
- Airflow
- Style
- TaskFlow decorators
- Tasks
- 4
- Edges
- 3
- Schedule
- 0 4 * * *
- Edge Case
- dependencies implied by function calls
Testing contract
Expected to pass- Scenario
- Recover dependencies from a TaskFlow DAG where no >> operator appears
- Expected result
- Four tasks resolve and transform fans out to both publish and audit through its return value, giving three edges
What is a .py file?
Python (.py) is a plain-text source file for the Python programming language — a dynamically typed, indentation-structured language widely used for scripting, data science, web back-ends, and automation. A .py file is compiled to bytecode and run by the Python interpreter.
How to use this file
Use an example .py file to test syntax highlighters, linters (like flake8 or ruff), formatters (black), tree-sitter grammars, and language-detection or code-editor tooling against known-correct source.
How to use this file for testing
“Airflow TaskFlow API DAG” is a deterministic Novus Examples fixture for Graph data, Data engineering, Conversion testing. Node/edge datasets in GraphML and GEXF (directed and undirected, with attributes and weights) — for testing network importers, layout tools, and graph converters.
Documented properties for this file: 3 edges. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.
Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.
Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.
Code examples
python airflow-dag-taskflow.pyRelated files
- pyAirflow DAG Definition (Operator Style)An Airflow DAG definition in the classic operator style, using only the no-op EmptyOperator so the file describes a topology and performs no work. Carries the six-task ETL graph shared across the Airflow JSON, Argo, Graphviz and Mermaid fixtures.

- jsonAirflow-Shaped Serialized DAG (JSON)The serialized-DAG shape Airflow stores in its metadata database, as standalone JSON: per-task metadata with explicit downstream_task_ids. Carries the same six-task topology as the Python, Argo, Graphviz and Mermaid fixtures.

- jsonPipeline DAG Topology (JSON, with Expected Answers)The shared six-task topology as a plain node/edge JSON document that also publishes the expected answers — roots, leaves, longest path, and topological order — so a graph library or DAG visualiser can be scored without a hand-written oracle.

- yamlArgo Workflow DAG TemplateAn Argo Workflows DAG template carrying the same six-task ETL topology as the Airflow, Graphviz and Mermaid fixtures in this category, so a converter or visualiser can be scored against one known answer across four formats.

- yamlArgo Workflow Steps TemplateArgo's steps template, whose double-nested list is a genuine parser trap: the outer list is sequential and the inner list is parallel, so a reader that flattens it reports four sequential steps instead of three groups.

- cwlCWL Scatter and Cross-ProductCWL scatter in both forms: a single-parameter scatter over an array input, and a two-parameter scatter with scatterMethod flat_crossproduct. The scatter dimensionality is what distinguishes correct CWL engines from approximate ones.

Generated by generation/pipelines.py. Free for any use, no attribution required — license.