Skip to content

Conversation

@ephraimbuddy
Copy link
Contributor

From the comment on exception handling when a task is killed externally we do not handle callback thus
the above fix was made in error. Here's the comment on code:

for case when task is marked as success/failed externally
or dagrun timed out and task is marked as skipped
current behavior doesn't hit the callbacks

# for case when task is marked as success/failed externally
# or dagrun timed out and task is marked as skipped
# current behavior doesn't hit the callbacks

closes: #30146

@ephraimbuddy ephraimbuddy force-pushed the fix-failure-callback branch from 23aa472 to aa03627 Compare March 17, 2023 09:07
Copy link

@eejbyfeldt eejbyfeldt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert sounds like the right choice to me.

I think it could be nice to add the test cases from: #30146 to prevent similarly bad changes being introduced in the future. But maybe that is better done in a followup PR.

@ephraimbuddy ephraimbuddy force-pushed the fix-failure-callback branch from aa03627 to 5f066f2 Compare March 17, 2023 09:10
From the comment on exception handling when a task is killed externally we do not handle callback thus
the above fix was made in error. Here's the comment on code:

 for case when task is marked as success/failed externally
 or dagrun timed out and task is marked as skipped
 current behavior doesn't hit the callbacks

https://github.com/apache/airflow/blob/b65dbaaf3f21ea5396da121bbfa7f895d0ab8516/airflow/models/taskinstance.py#L1468-L1470
@ephraimbuddy ephraimbuddy force-pushed the fix-failure-callback branch from 5f066f2 to ced9f99 Compare March 17, 2023 09:15
@ephraimbuddy
Copy link
Contributor Author

Revert sounds like the right choice to me.

I think it could be nice to add the test cases from: #30146 to prevent similarly bad changes being introduced in the future. But maybe that is better done in a followup PR.

Feel free to make the PR once this is merged. Also we can add a comment on the signal handler itself to say that we don't handle callbacks when tasks are marked failed externally

@potiuk
Copy link
Member

potiuk commented Mar 17, 2023

Also we can add a comment on the signal handler itself to say that we don't handle callbacks when tasks are marked failed externally

Good idea. I think that's the super-easy (though temporary) fix.

Co-authored-by: Emil Ejbyfeldt <eejbyfeldt@liveintent.com>
@ephraimbuddy ephraimbuddy merged commit 869c1e3 into apache:main Mar 17, 2023
@ephraimbuddy ephraimbuddy deleted the fix-failure-callback branch March 17, 2023 10:52
@pierrejeambrun pierrejeambrun added the type:bug-fix Changelog: Bug Fixes label Mar 22, 2023
@pierrejeambrun pierrejeambrun added this to the Airflow 2.5.3 milestone Mar 22, 2023
pierrejeambrun pushed a commit that referenced this pull request Mar 23, 2023
* Revert fix for on_failure_callback when task receives a SIGTERM

From the comment on exception handling when a task is killed externally we do not handle callback thus
the above fix was made in error. Here's the comment on code:

 for case when task is marked as success/failed externally
 or dagrun timed out and task is marked as skipped
 current behavior doesn't hit the callbacks

https://github.com/apache/airflow/blob/b65dbaaf3f21ea5396da121bbfa7f895d0ab8516/airflow/models/taskinstance.py#L1468-L1470

* Update tests/models/test_taskinstance.py

Co-authored-by: Emil Ejbyfeldt <eejbyfeldt@liveintent.com>

---------

Co-authored-by: Emil Ejbyfeldt <eejbyfeldt@liveintent.com>
(cherry picked from commit 869c1e3)
pierrejeambrun pushed a commit that referenced this pull request Mar 24, 2023
* Revert fix for on_failure_callback when task receives a SIGTERM

From the comment on exception handling when a task is killed externally we do not handle callback thus
the above fix was made in error. Here's the comment on code:

 for case when task is marked as success/failed externally
 or dagrun timed out and task is marked as skipped
 current behavior doesn't hit the callbacks

https://github.com/apache/airflow/blob/b65dbaaf3f21ea5396da121bbfa7f895d0ab8516/airflow/models/taskinstance.py#L1468-L1470

* Update tests/models/test_taskinstance.py

Co-authored-by: Emil Ejbyfeldt <eejbyfeldt@liveintent.com>

---------

Co-authored-by: Emil Ejbyfeldt <eejbyfeldt@liveintent.com>
(cherry picked from commit 869c1e3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

on_failure_callback call multiple times and when task has retries

4 participants