This is an automated email from the ASF dual-hosted git repository.
jscheffl pushed a commit to branch v2-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v2-10-test by this push:
new d3595a2e04 Improving validation of task retries to handle None values
(#42532) (#42915)
d3595a2e04 is described below
commit d3595a2e040d21b7307bc553989bd3440dc76277
Author: Jens Scheffler <[email protected]>
AuthorDate: Thu Oct 10 22:05:56 2024 +0200
Improving validation of task retries to handle None values (#42532) (#42915)
* Improving validation of task retries to handle None values
* Updated the validation check to use the "or" logical operator
Co-authored-by: Jens Scheffler <[email protected]>
* Added a comment for the new validation check
* Update baseoperator.py
* Update taskinstance.py
---------
Co-authored-by: Jens Scheffler <[email protected]>
(cherry picked from commit 1114ab2d03c4c58a68f0a75f03c82a39385c60d0)
Co-authored-by: sonu4578 <[email protected]>
---
airflow/models/baseoperator.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/airflow/models/baseoperator.py b/airflow/models/baseoperator.py
index f21db0c675..9da4b619d7 100644
--- a/airflow/models/baseoperator.py
+++ b/airflow/models/baseoperator.py
@@ -131,7 +131,9 @@ logger =
logging.getLogger("airflow.models.baseoperator.BaseOperator")
def parse_retries(retries: Any) -> int | None:
- if retries is None or type(retries) == int: # noqa: E721
+ if retries is None:
+ return 0
+ elif type(retries) == int: # noqa: E721
return retries
try:
parsed_retries = int(retries)