kani5hk commented on a change in pull request #4877: [AIRFLOW-4046] Added 
validations for poke_interval & timeout for Airflow Sensor
URL: https://github.com/apache/airflow/pull/4877#discussion_r263690806
 
 

 ##########
 File path: airflow/sensors/base_sensor_operator.py
 ##########
 @@ -70,6 +70,14 @@ def __init__(self,
                  *args,
                  **kwargs):
         super(BaseSensorOperator, self).__init__(*args, **kwargs)
+        if isinstance(poke_interval, str) or poke_interval < 0:
+             raise AirflowException(
+                "The poke_interval must be a non-negative number"
+                )
+        if isinstance(timeout, str) or timeout < 0:
+             raise AirflowException(
+                "The timeout must be a non-negative number"
+                )
 
 Review comment:
   Thanks @XD-DENG for a quick review, actually sleep(True) is considered as 
sleep(1) and sleep(0) for sleep(False), so it's also kind of handled already. 
Thoughts?
   I'll remove string type comparison though.
   
   Also, some goof up has been done due to which this PR got closed, I've 
opened another one https://github.com/apache/airflow/pull/4878

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to