XD-DENG 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_r263688154
##########
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:
I'm not sure if it's necessary to check types here. Because if you provide
an invalid type for `timeout` or `poke_interval`, the `execute` method will
fail and give exception later anyway.
On the other hand, if I provide a Boolean value here for `timeout` or
`poke_interval`, it should be captured as invalid type as well while it's not
covered here.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services