Commands icon
If icon
SlackIncomingWebhook icon
Schedule icon

Apache Airflow DAG Run Queued Stagnation and Scheduler Lag Sentinel

Audits Apache Airflow REST API for stalled queued DAG runs and scheduler heartbeats to prevent pipeline delays.

Categories
DataInfrastructure

How it works

This workflow queries the Apache Airflow Stable REST API (/api/v1/dags/~/dagRuns?state=queued) to monitor the total volume of DAG runs stuck in the queued state. In Apache Airflow, when scheduler processes crash, experience database deadlock contention, or when worker slots (Celery, KubernetesExecutor) are exhausted by long-running sensor tasks, DAG runs pile up in the queue without transitioning to running. This workflow tracks queued runs and alerts data engineering teams before batch SLA breaches occur.

What you get

  • Real-time detection of scheduler deadlocks and worker starvation in Apache Airflow.
  • Prevents cascading ETL pipeline delays across data warehouse and BI jobs.
  • Quantitative tracking of queued DAG runs across the entire Airflow instance.

Who it's for

  • Data Platform Engineers and Airflow Administrators.
  • Analytics Engineers responsible for timely pipeline execution.

Why orchestrate this with Kestra

  • Cross-Orchestrator Governance: Monitor legacy Airflow pipelines from a modern, reliable Kestra control plane.
  • Decoupled Architecture: Scrapes Airflow REST endpoints without dependencies on internal Airflow workers.
  • Instant Team Escalation: Delivers structured notifications with queued run counts directly to Slack.

Prerequisites

  • Apache Airflow (v2.0+) instance with REST API enabled.
  • Secrets AIRFLOW_PASSWORD and SLACK_WEBHOOK configured in Kestra.

Quick start

  1. Import the blueprint.
  2. Input Airflow URL, user, and queued threshold.
  3. Run the workflow to inspect queued DAG runs.

How to extend

  • Query /api/v1/health to verify Airflow scheduler heartbeat timestamp.
  • Automatically trigger a scheduler container restart via Kubernetes API if queued runs persist.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.