15 — Pipeline & Automation

Orchestration & Scheduling#

InfrastructurePractice
◆ The PatternDAGs, retries, backfills, and trigger strategies

Orchestrators manage the when, how, and what-if of ML workflows. Airflow, Prefect, and Dagster define DAGs with dependency resolution, automatic retries, and backfill capabilities. Good orchestration means your retraining runs reliably at 2 AM without you.

// Interactive — DAG dependency graph
Pattern bridge: Orchestration DAGs structure ML workflows the same way computation graphs structure neural networks — directed, acyclic, and dependency-ordered. In markets, systematic trading rules follow the same sequential logic.
Worked example

A task that fails transiently one time in five succeeds within three retries with probability 99.84%. Spacing the retries at 30, 60 and 120 seconds lets a struggling dependency recover instead of being hammered. And when a bug is fixed, a backfill re-runs the daily DAG for each of the last 90 days.

Where it misleads
  • Retries only help transient failures; a bug fails four times instead of once.
  • Retries without jitter synchronize clients into waves that can take a service down again.
  • Backfills of non-idempotent tasks double-write; make each run safe to repeat.
In code
p_fail = 0.20                          # a task fails transiently one time in five
retries = 3
p_success = 1 - p_fail ** (retries + 1)
backoff = [30 * 2 ** k for k in range(retries)]           # seconds between attempts: exponential
backfill_runs = 90                                         # a daily DAG re-run for the last 90 days
Python, in your browser — edit the code and run it again

Assumes import numpy as np and import pandas as pd. Each snippet carries its own example numbers; the comments say which are made up or simulated.

The same idea with a library
# Python — Airflow DAG for retraining
from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime

dag = DAG("retrain_model",
          schedule_interval="0 2 * * *",
          start_date=datetime(2025, 1, 1))

ingest = PythonOperator(task_id="ingest", python_callable=ingest_data, dag=dag)
train  = PythonOperator(task_id="train",  python_callable=train_model,  dag=dag)
eval_  = PythonOperator(task_id="eval",   python_callable=evaluate,     dag=dag)
deploy = PythonOperator(task_id="deploy", python_callable=deploy_model, dag=dag)

ingest >> train >> eval_ >> deploy
Sources
  • Apache Airflow documentation, airflow.apache.org — retries, scheduling and backfill
  • M. Brooker, “Exponential Backoff and Jitter”, AWS Architecture Blog, 2015
  • Site Reliability Engineering: How Google Runs Production Systems, B. Beyer, C. Jones, J. Petoff & N. R. Murphy (eds.), O’Reilly, 2016

Last reviewed October 2026 · How this site checks its content · Report a mistake

Linked from 1
← Previous
CI/CD for ML
Open in the full reader, with the topic sidebar