This is an automated email from the ASF dual-hosted git repository. jscheffl pushed a commit to branch validation-of-none-retries-setting-v2-backport in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 8c3e4bb13ada661cfbbb94b107e41971049a9a20 Author: sonu4578 <[email protected]> AuthorDate: Wed Oct 9 13:03:40 2024 -0700 Improving validation of task retries to handle None values (#42532) * 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) --- 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)
