Orchestration
Schedule pipeline steps with Apache Airflow and Argo Workflows on OpenShift: calendars, retries, dependencies, and which one to pick for a data job.
A pipeline step that runs only when someone remembers it will be late, and it will be late on the day the numbers matter. Orchestration runs the steps in order, on a clock, and again after a failure. It also refuses to start a second copy while the first is still going.
This lab schedules one small pipeline: extract yesterday's accounts, merge them with Spark, then check the result. The extract is the job from the ingestion lab. The merge is the SparkApplication from the Spark lab. The check is a single query that fails the run when silver is empty. We run that shape in two tools, Apache Airflow and Argo Workflows, and we use both in the lab for different jobs.
One boundary before the tools. The Debezium connector is not a task in this DAG. It runs all day, on its own, because change data capture is a stream. The schedule owns the batch extract, the merge of a day's files into Iceberg, and the check. Putting a connector start/stop inside a nightly DAG is how slots get paused and disks fill up.
Prerequisites
- OpenShift 4.x and
oc - Airflow running in the
airflownamespace, scheduler deploymentairflow-scheduler, with thecncf.kubernetesprovider installed. The scheduler's service account can create pods andSparkApplicationresources indata-pipeline - Argo Workflows installed, with permission to create workflows in
data-pipeline, and theargoCLI if you want it (everything here also works withoc) - The
extractandspark-icebergimages, thelakehousesecret, and the Kafka and Postgres pieces those jobs already use - Pipeline code and these YAML files in Git, deployed the same way as the rest of the platform. The GitOps lab is that path. OpenShift Pipelines (Tekton) builds the images; it is not the clock for this data run
Times in this lab are Asia/Dhaka. A cron expression with no timezone is UTC, and 2:15 UTC is 8:15 a.m. in Dhaka, which is after people have started asking where the file is.
The pipeline both tools run
| Step | Does | Starts only after |
|---|---|---|
extract_accounts |
Writes bronze/accounts/dt=<date>/accounts.csv |
The schedule |
accounts_silver |
Merges that day into silver.accounts |
The extract finished |
quality_accounts |
Fails the run if that day's silver slice is empty | The merge finished |
Each step is safe to run twice for the same date. The extract overwrites one object. The merge is an Iceberg MERGE. The check only reads. A retry must not append a second copy of the day.
Airflow
Airflow is a Python process that stores DAG runs in its own database and runs tasks on workers. On OpenShift the worker for these tasks is Kubernetes: each task is a pod, or a SparkApplication the provider creates and waits on. The DAG file lives in the DAGs folder (a Git-sync volume in our lab, not a copy someone oc rsyncs in).
start_date carries the timezone, so 15 2 * * * is 2:15 a.m. in Dhaka. catchup=False means turning the DAG on today does not queue a run for every day since January. max_active_runs=1 is the same idea as Forbid on a CronJob.
from datetime import timedelta
import pendulum
from airflow import DAG
from airflow.providers.cncf.kubernetes.operators.pod import KubernetesPodOperator
from airflow.providers.cncf.kubernetes.operators.spark_kubernetes import (
SparkKubernetesOperator,
)
with DAG(
dag_id="accounts_daily",
schedule="15 2 * * *",
start_date=pendulum.datetime(2026, 1, 1, tz="Asia/Dhaka"),
catchup=False,
max_active_runs=1,
default_args={
"retries": 2,
"retry_delay": timedelta(minutes=5),
},
) as dag:
extract = KubernetesPodOperator(
task_id="extract_accounts",
name="extract-accounts",
namespace="data-pipeline",
image="image-registry.openshift-image-registry.svc:5000/data-pipeline/extract:latest",
cmds=["/opt/jobs/extract_accounts.sh"],
env_vars={"DT": "{{ ds }}"},
)
silver = SparkKubernetesOperator(
task_id="accounts_silver",
namespace="data-pipeline",
application_file="spark/accounts-silver.yaml",
do_xcom_push=False,
)
quality = KubernetesPodOperator(
task_id="quality_accounts",
name="quality-accounts",
namespace="data-pipeline",
image="image-registry.openshift-image-registry.svc:5000/data-pipeline/spark-iceberg:3.5",
cmds=["/opt/jobs/quality_accounts.sh"],
env_vars={"DT": "{{ ds }}"},
)
extract >> silver >> quality
{{ ds }} is the run's logical date, so a rerun of 28 October still writes dt=2026-10-28. Put that same {{ ds }} in the Spark YAML's path argument; Airflow renders .yaml files it is given. Two retries, five minutes apart, cover an evicted pod or a storage timeout. A quality failure means the extract was empty: read the log.
New DAGs are paused until someone unpauses them.
oc exec -n airflow deploy/airflow-scheduler -- airflow dags list
oc exec -n airflow deploy/airflow-scheduler -- airflow dags unpause accounts_daily
oc exec -n airflow deploy/airflow-scheduler -- airflow dags trigger accounts_daily
oc exec -n airflow deploy/airflow-scheduler -- \
airflow tasks test accounts_daily quality_accounts 2026-10-28
airflow tasks test runs one task for one logical date. A backfill is one triggered date at a time, so the first failure stays visible.
Argo Workflows
Argo is a Kubernetes controller. A workflow is a custom resource, each step is a pod (or another Kubernetes object), and there is no scheduler database to back up. We use it for jobs we want to read as YAML next to the other manifests, and for runs a person starts by hand: rebuild a month, reload a partner file, compact a table.
This workflow is one run. generateName keeps every attempt. retryStrategy is on the template. extract-accounts.Succeeded is the dependency, so a failed extract does not start Spark.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: accounts-daily-
namespace: data-pipeline
spec:
entrypoint: pipeline
serviceAccountName: pipeline
templates:
- name: pipeline
dag:
tasks:
- name: extract-accounts
template: run
arguments:
parameters:
- {name: step, value: extract}
- name: accounts-silver
depends: extract-accounts.Succeeded
template: run
arguments:
parameters:
- {name: step, value: silver}
- name: quality-accounts
depends: accounts-silver.Succeeded
template: run
arguments:
parameters:
- {name: step, value: quality}
- name: run
retryStrategy:
limit: "2"
retryPolicy: Always
backoff:
duration: "1m"
factor: "2"
maxDuration: "10m"
inputs:
parameters:
- name: step
container:
image: image-registry.openshift-image-registry.svc:5000/data-pipeline/pipeline-steps:latest
command: ["/opt/jobs/run.sh", "{{inputs.parameters.step}}"]
env:
- name: DT
value: "2026-10-29"
envFrom:
- secretRef:
name: lakehouse
pipeline-steps calls the extract, submits the Spark lab's SparkApplication, or runs the quality check. The clock is a CronWorkflow around the same spec. timezone is the field people miss.
apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
name: accounts-daily
namespace: data-pipeline
spec:
schedule: "15 2 * * *"
timezone: Asia/Dhaka
concurrencyPolicy: Forbid
workflowSpec:
# Same entrypoint, serviceAccountName and templates as the Workflow above.
entrypoint: pipeline
serviceAccountName: pipeline
Forbid skips the next morning if tonight's run is still going. Copy the Workflow templates into workflowSpec before you apply the CronWorkflow. argo retry reruns the failed steps and keeps the ones that succeeded, which is safe because each step is idempotent.
oc apply -f accounts-workflow.yaml
oc get workflows -n data-pipeline
argo logs -n data-pipeline @latest
argo retry -n data-pipeline @latest
oc apply -f accounts-cronworkflow.yaml
argo submit -n data-pipeline --from cronwf/accounts-daily
oc logs -n data-pipeline \
-l workflows.argoproj.io/workflow=accounts-daily-xxxxx --all-containers
When to use which
| Airflow | Argo Workflows | |
|---|---|---|
| You describe the job in | Python | YAML |
| The clock | A DAG schedule, timezone from start_date |
A CronWorkflow with timezone |
| A dependency | extract >> silver >> quality |
depends: extract-accounts.Succeeded |
| A retry | retries and retry_delay on the task |
retryStrategy on the template |
| A step | An operator: a pod, or a SparkApplication |
A container, or a Kubernetes object the workflow creates |
| A past date | Trigger that logical date; the DAG knows the calendar | Pass DT and submit a workflow |
| Fits | Many scheduled pipelines, a team that already works in Python, backfills | Jobs that should live next to other manifests, one-off rebuilds, file-arrival runs |
In our lab the calendar pipelines are Airflow. Reloads, compaction and a file that just landed are Argo. Both start the same SparkApplication. One pipeline has one scheduler.
Failure habits
- One run at a time.
max_active_runs=1andconcurrencyPolicy: Forbid. - Retries for infrastructure, a hard stop for data. Two tries is enough for a node eviction. A quality failure waits for a person. The checks themselves grow in the quality and governance lab.
- The date is an argument. Never let a script call
dateand decide it is working on today. The scheduler already chose the day. - Alert on the failed workflow, through the same OpenShift alerting you use for other workloads. A green cluster with a red DAG is still a missed file.
- Keep Connect out of the DAG. Pause a Debezium connector only for a database window, then resume it.
- A 2:15 run at 8:15 means the cron is still UTC. A doubled retry means the step appended. An Argo step stuck
Pendingmeans thepipelineservice account cannot create pods.
What's next
- Apache Spark: the merge this schedule starts, and the YAML
SparkKubernetesOperatorapplies. - Ingestion: the extract, the file landing, and the connector you should leave running.
- Data lakehouse: what silver and gold contain after the run, and the compaction workflow you can hang off the same scheduler.
- Data quality and governance: replace the empty-table check with real tests, still as a step that fails the run. The pipeline overview is why a step has to be safe to run twice.