Skip to content

Instantly share code, notes, and snippets.

@nathairtras
nathairtras / callback_retry_clear_subdag.py
Last active May 28, 2021 15:47
Callback to clear Airflow SubDag on retry
import logging
from airflow.models import DagBag
def callback_subdag_clear(context):
"""Clears a subdag's tasks on retry."""
dag_id = "{}.{}".format(
context['dag'].dag_id,
context['ti'].task_id,
)
execution_date = context['execution_date']