Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AIP-72: Handling failed TI state for AirflowFailException & AirflowSensorTimeout #44954

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

amoghrajesh
Copy link
Contributor

related: #44414

We already have support for handling terminal states from the task execution side as well as the task SDK client side. (almost) and failed state is part of the terminal state.

This PR extends the task runner's run function to handle cases when we have to fail a task: AirflowFailException, AirflowSensorTimeout. It is functionally very similar to #44786

As part of failing a task, multiple other things also needs to be done like:

Testing performed

End to End with Postman

  1. Run airflow with breeze and run any DAG
    image

  2. Login to metadata DB and get the "id" for your task instance from TI table
    image

  3. Send a request to fail your task
    image

Or using curl:

curl --location --request PATCH 'http://localhost:29091/execution/task-instances/0193cec2-f46b-7348-9c27-9869d835dc7b/state' \
--header 'Content-Type: application/json' \
--data '{
    "state": "failed",
    "end_date": "2024-10-31T12:00:00Z"
}'
  1. Refresh back the Airflow UI to see that the task is in failed state.
    image

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@amoghrajesh amoghrajesh changed the title Aip72 failexception AIP-72: Handling failed TI state for AirflowFailException & AirflowSensorTimeout Dec 16, 2024
@amoghrajesh amoghrajesh self-assigned this Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant