Afz Abd
Afz Abd

Reputation: 493

Airflow - Skip future task instance without making changes to dag file


How can I skip that particular task instance?

Appreciate any help on this.

Upvotes: 3

Views: 1323

Answers (1)

SergiyKolesnikov
SergiyKolesnikov

Reputation: 7815

You can mark the unwanted tasks as succeeded using the run command. The tasks marked as succeeded will not be run anymore.

Assume, there is a DAG with ID a_dag and three tasks with IDs dummy1, dummy2, dummy3. We want to skipp the dummy3 task from the next DAG run.

First, we get the next execution date:

$ airflow next_execution a_dag
2020-06-12T21:00:00+00:00

Then we mark dummy3 as succeeded for this execution date:

$ airflow run -fAIim a_dag dummy3 '2020-06-12T21:00:00+00:00'

To be sure, we can check the task state. For the skipped task it will be success:

$ airflow task_state a_dag dummy3 '2020-06-12T21:00:00+00:00'
...
success

For the rest of the tasks the state will be None:

$ airflow task_state a_dag dummy1 '2020-06-12T21:00:00+00:00'
...
None

Upvotes: 3

Related Questions