Create a airflow job to run only once


Can you please let me know how to create a airflow job to run only once? Means will not be run second time.


1 Like

There are some preset schedule available in airflow! You can find more information under the DAG runs section of the official airflow document. The one that will denote that a DAG is to be scheduled only once would be the @once macro.

It should look something similar to this instantiation of a DAG object

from airflow.models import DAG

dag = DAG(

Once a dagrun has been created, it will not create anymore regardless of the state of the dagrun.


Thank you @Alan for great help.