dstandish commented on code in PR #27597:
URL: https://github.com/apache/airflow/pull/27597#discussion_r1019604511


##########
airflow/sensors/base.py:
##########
@@ -122,8 +124,17 @@ def __init__(
         self.timeout = timeout
         self.mode = mode
         self.exponential_backoff = exponential_backoff
+        self.max_wait = self._coerce_max_wait(max_wait)
         self._validate_input_values()
 
+    @staticmethod
+    def _coerce_max_wait(max_wait: float | timedelta | None) -> timedelta | 
None:
+        if max_wait is None or isinstance(max_wait, timedelta):
+            return max_wait
+        if isinstance(max_wait, (int, float)) and max_wait >= 0:
+            return timedelta(seconds=max_wait)
+        raise AirflowException("The max_wait must be timedelta object or a 
non-negative number")

Review Comment:
   ```suggestion
           raise AirflowException("Operator arg `max_wait` must be timedelta 
object or a non-negative number")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to