Search code examples
google-cloud-platformairflowdirected-acyclic-graphsgoogle-cloud-composergoogle-cloud-shell

Airflow: Getting ERROR when trying to list DAGs by status "ON/OFF" in Cloud Shell


I am using Cloud Shell to list the DAGs where the status is "ON" or "OFF" - and I am using the following command:

gloud composer environments storage dags list --environment=ENVIRONMENT --location=LOCATION --status=ON

However, when I try to execute the command above to list the DAGs that are "ON", I get this error:

ERROR: (gcloud.composer.environments.storage.dags.list) unrecognized arguments: --status=ON

I can clearly see that the issue is regarding the --status=ON - therefore, what do I need to do in order to fix this error?


Solution

  • --status is not a valid argument for the airflow dags list CLI command.

    If you are trying to retrieve DAGs that are not paused, you can output the results from airflow dags list to a JSON object (i.e. airflow dags list --output json) and iterate over that array to print what DAGs are currently unpaused (i.e. paused=False).