Data pipeline orchestration

From makifbaysal/tasktrooper · View interactive version

Data pipeline orchestration is an AI agent skill from the GitHub repository makifbaysal/tasktrooper. Use when adding or changing a scheduled data or ML pipeline — Dagster assets, Prefect flows, Airflow DAGs or a cron'd entrypoint — idempotent partitioned stages, retries, backfills, quality gates, and testing the pipeline without the scheduler

How to use this skill

Skill file

Data Pipeline Orchestration

Overview

A pipeline runs unattended, gets retried, gets backfilled for last March, and runs twice when someone clicks the button twice. Each stage therefore has to produce the same result for the same inputs no matter how often it runs, and fail loudly when its input is wrong.

Core principle: business logic lives in plain, tested functions; the orchestrator layer is a thin wrapper that wires partitions, resources and retries around them.

1. Detect the orchestrator — and keep it

| You find | It is |

|---|---|

| @dg.asset, Definitions(...), dagster.yaml, workspace.yaml | Dagster (asset-based) |

| @flow, @task from prefect, prefect.yaml | Prefect |

| dags/ folder, @dag / DAG(...), from airflow | Airflow (Airflow 3 imports authoring APIs from airflow.sdk) |

| dvc.yaml stages | DVC pipeline (experiment-tracking-and-reproducibility) |

| a cron entry or a CI schedule calling a CLI | plain entrypoint |

Never add a second orchestrator (rule stack-choice). A plain CLI entrypoint called by the existing scheduler is often the right size.

2. Thin orchestration, testable logic

# src/churn/features.py — pure, tested with fixtures
def build_daily_features(orders: pd.DataFrame, day: date) -> pd.DataFrame: ...

# src/churn/orchestration/assets.py — wiring only
import dagster as dg

daily = dg.DailyPartitionsDefinition(start_date="2025-01-01")

@dg.asset(partitions_def=daily)
def daily_features(context: dg.AssetExecutionContext, warehouse: WarehouseResource) -> None:
    day = date.fromisoformat(context.partition_key)
    features = build_daily_features(warehouse.orders_for(day), day)
    warehouse.overwrite_partition("features.daily", day, features)

The asset never computes anything itself; build_daily_features has unit tests that know nothing about Dagster.

3. Idempotency

| ❌ | ✅ |

|---|---|

| INSERT INTO features SELECT ... on every run | delete-then-insert the partition in one transaction, MERGE on the key, or INSERT OVERWRITE the partition |

| df.to_parquet("out/features.parquet", append...) | write out/day=2026-10-01/part.parquet to a temp path, then rename |

| window_end = datetime.now() | window from the partition key or the run's data interval |

| file names with a timestamp of when it ran | paths keyed by what the data is for (partition, model version) |

Test it: run the stage twice on the fixture; the output is identical and the row count does not double.

4. Retries, failures and gates

5. Backfills and partitions

6. Testing without the scheduler

def test_daily_features_overwrites_its_partition(tmp_warehouse) -> None:
    for _ in range(2):
        result = dg.materialize(
            [daily_features],
            partition_key="2026-10-01",
            resources={"warehouse": tmp_warehouse},
        )
        assert result.success
    assert tmp_warehouse.row_count("features.daily", day=date(2026, 10, 1)) == 3

7. Secrets and configuration

Credentials come from the orchestrator's resources, connections or environment — never in code, never in DAG parameters. A new variable the deployed pipeline reads is declared with declare_env_vars. In Airflow, never render user-supplied parameters into Jinja-templated SQL or shell commands; pass them as bound parameters.

8. Rollout

A changed pipeline runs side by side (shadow output to a separate table or path) before it replaces the old output, when the task's risk warrants it; the cut-over and the rollback (point consumers back, re-run the old version for affected partitions) go in after_deploy and rollback_plan.

Common Mistakes

Red Flags

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.