This is an automated email from the ASF dual-hosted git repository.

jscheffl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 1114ab2d03c Improving validation of task retries to handle None values 
(#42532)
1114ab2d03c is described below

commit 1114ab2d03c4c58a68f0a75f03c82a39385c60d0
Author: sonu4578 <veetech4...@gmail.com>
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 <95105677+jsche...@users.noreply.github.com>
    
    * Added a comment for the new validation check
    
    * Update baseoperator.py
    
    * Update taskinstance.py
    
    ---------
    
    Co-authored-by: Jens Scheffler <95105677+jsche...@users.noreply.github.com>
---
 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 9e0c8e1e69b..7b5c8e7c4f8 100644
--- a/airflow/models/baseoperator.py
+++ b/airflow/models/baseoperator.py
@@ -127,7 +127,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)

Reply via email to