-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change AirflowTaskTimeout to inherit BaseException (#35653)
Code that normally catches Exception should not implicitly ignore interrupts from AirflowTaskTimout. Fixes #35644 #35474
- Loading branch information
Showing
7 changed files
with
47 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
``AirflowTimeoutError`` is no longer ``except``ed by default through ``Exception`` | ||
|
||
The ``AirflowTimeoutError`` is now inheriting ``BaseException`` instead of | ||
``AirflowException``->``Exception``. | ||
See https://docs.python.org/3/library/exceptions.html#exception-hierarchy | ||
|
||
This prevents code catching ``Exception`` from accidentally | ||
catching ``AirflowTimeoutError`` and continuing to run. | ||
``AirflowTimeoutError`` is an explicit intent to cancel the task, and should not | ||
be caught in attempts to handle the error and return some default value. | ||
|
||
Catching ``AirflowTimeoutError`` is still possible by explicitly ``except``ing | ||
``AirflowTimeoutError`` or ``BaseException``. | ||
This is discouraged, as it may allow the code to continue running even after | ||
such cancellation requests. | ||
Code that previously depended on performing strict cleanup in every situation | ||
after catching ``Exception`` is advised to use ``finally`` blocks or | ||
context managers. To perform only the cleanup and then automatically | ||
re-raise the exception. | ||
See similar considerations about catching ``KeyboardInterrupt`` in | ||
https://docs.python.org/3/library/exceptions.html#KeyboardInterrupt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters