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
…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 <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)

Co-authored-by: sonu4578 <veetech4455@gmail.com>
  • Loading branch information
2 people authored and utkarsharma2 committed Oct 24, 2024
1 parent a94e906 commit ae78392
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 ae78392

Please sign in to comment.