Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS MWAA (Managed Apache Airflow); Programmatically enable DAGs

We are using AWS MWAA. We add our DAG.py files to our S3 bucket programatically. They then show up in the UI. However, they are "OFF" and you must click the "ON" button to start them.

EDIT: Also we may sometimes want to turn a DAG that's ON to OFF (programatically)

I am looking to do this programmatically, however I cannot figure out to.

The API does not seem to have it: https://docs.aws.amazon.com/mwaa/latest/userguide/mwaa-actions-resources.html

Boto does not seem to have it: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/mwaa.html

Is it possible to manipulate a DAGs status from OFF/ON ON/OFF via API?

like image 733
Tommy Avatar asked May 08 '26 16:05

Tommy


1 Answers

This is not doable via API but you can use is_paused_upon_creation this flag specifies if the dag is paused when created for the first time. If the dag exists already, this flag will be ignored.

You can set is_paused_upon_creation=False in the DAG contractor.

dag = DAG(
    dag_id='tutorial',
    default_args=default_args,
    is_paused_upon_creation=False,
)

Another option is to do it via unpause CLI:

airflow dags unpause [-h] [-S SUBDIR] dag_id
like image 113
Elad Kalif Avatar answered May 10 '26 13:05

Elad Kalif



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!