'Skip run if DAG is already running

I have a DAG that I need to run only one instance at the same time. To solve this I am using max_active_runs=1 which works fine:

dag_args = {
    'owner': 'Owner',
    'depends_on_past': False,
    'start_date': datetime(2018, 01, 1, 12, 00),
    'email_on_failure': False
}

sched = timedelta(hours=1)
dag = DAG(job_id, default_args=dag_args, schedule_interval=sched, max_active_runs=1)

The problem is:

When DAG is going to be triggered and there's an instance running, AirFlow waits for this run to finish and then triggers the DAG again.

My question is:

Is there any way to skip this run so DAG will not run after this execution in this case?

Thanks!



Solution 1:[1]

This is just from checking the docs, but it looks like you only need to add another parameter:

catchup=False

catchup (bool) – Perform scheduler catchup (or only run latest)? Defaults to True

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PuppyKhan