hterik opened a new issue, #35625:
URL: https://github.com/apache/airflow/issues/35625
### Apache Airflow version
2.7.3
### What happened
Assume following code runs inside airflow task:
```py
errors = []
for item in items_to_process:
try:
process(item) # This can take several minutes/hours each
except Exception as e:
errors.append(e)
if errors:
raise Exception(......)
```
If the Airflow task time out, what happens is that it injects an
`AirflowTaskTimeout` exception where the code is currently running now.
If the code is designed to capture exceptions, it will capture the timeout
and potentially continue running for several hours anyway.
### What you think should happen instead
I think it would be better if `AirflowTaskTimeout` was treated similarly to
`KeyboardInterrupt`, so it need explicit `except` block to capture.
Moving it outside of the `Exception` inheritance tree to inherit directly
from `BaseException` would solve that.
See https://docs.python.org/3/library/exceptions.html#exception-hierarchy
Timeouts are generally in place to be last resort of aborting process by the
higher level system if the lower level code has bugs in it, so it's safer to
assume that code that doesn't deal with catching timeout should be aborted.
### How to reproduce
See above
### Operating System
NA
### Versions of Apache Airflow Providers
apache-airflow==2.7.1
### Deployment
Official Apache Airflow Helm Chart
### Deployment details
_No response_
### Anything else
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]