Tomas Jansson
Tomas Jansson

Reputation: 23462

How do I clear the state of a dag run with the CLI in airflow/composer?

I thought I could use the command:

g beta composer environments run <env> --location=us-central1 clear -- <dag_id> -s 2018-05-13 -e 2018-05-14

the clear the state of the dag runs on 2018-05-13. For some reason it doesn't work. What happens is that the CLI hangs on a message like:

kubeconfig entry generated for <kube node name>.

What is the expected behavior of the command above? I would expect it to clear the dag run for the interval, but I might be doing something wrong.

Upvotes: 2

Views: 7033

Answers (3)

Soliman
Soliman

Reputation: 1204

You can use:

gcloud composer environments run instance-id --location us-central clear -- -s 2018-05-13 -e 2018-05-14 -dx DagID

where -dx will find all the dags with similar names to your dag, and -c will run the command without waiting your confirmation.

Upvotes: 1

Leo
Leo

Reputation: 930

Running clear on Cloud Composer requires you to add -c parameter to the command like so:

g beta composer environments run <env> --location=us-central1 clear -- <dag_id> -c -s 2018-05-13 -e 2018-05-14

Upvotes: 7

Wilson
Wilson

Reputation: 614

The behavior of the command you wrote is the same as running airflow clear on a local installation. Maybe the command is just running slow? Are you able to observe any changes to the task instances displayed in the Airflow web UI?

Upvotes: 1

Related Questions