Skip to content

Commit

Permalink
Improving validation of task retries to handle None values (#42532)
Browse files Browse the repository at this point in the history
* Improving validation of task retries to handle None values

* Updated the validation check to use the "or" logical operator

Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>

* Added a comment for the new validation check

* Update baseoperator.py

* Update taskinstance.py

---------

Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
(cherry picked from commit 1114ab2)
  • Loading branch information
sonu4578 authored and jscheffl committed Oct 10, 2024
1 parent 13e8e3e commit 8c3e4bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion airflow/models/baseoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@


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)
Expand Down

0 comments on commit 8c3e4bb

Please sign in to comment.