33

The goal is pretty simple: I need to create a DAG for a manual task that should not run periodically, but only when admin presses the "Run" button. Ideally without a need to switch "unpause" and "pause" the DAG (you know someone will surely forget to pause).

So far I only came with schedule_interval="0 0 30 2 *" (30th Feb hopefully never occurs), but there must be a better way!

Is there?

Ikar Pohorský
  • 4,617
  • 6
  • 39
  • 56

2 Answers2

46

Based on the documentation, you can set the scheduler preset to None (Don’t schedule, use for exclusively “externally triggered” DAGs). Also, you can set it to @once if schedule once and only once.

Yahia
  • 1,209
  • 1
  • 15
  • 18
8

Set schedule_interval=None.

For example:

from airflow import models

with models.DAG(
    'Your DAG',
    schedule_interval=None,
    start_date=datetime(2021, 1, 1)
) as dag:
...
miguel dias
  • 89
  • 1
  • 2