mik-laj commented on a change in pull request #4878: [AIRFLOW-4046] Added
validations for poke_interval & timeout for Airflow Sensor
URL: https://github.com/apache/airflow/pull/4878#discussion_r264013375
##########
File path: airflow/sensors/base_sensor_operator.py
##########
@@ -70,6 +70,12 @@ def __init__(self,
*args,
**kwargs):
super(BaseSensorOperator, self).__init__(*args, **kwargs)
+ if not isinstance(poke_interval, (int, float)) or poke_interval < 0:
Review comment:
In my opinion, if it is possible to say about a certain fragment of the code
that it has a certain role, it is worth creating a method from this fragment.
There are several reasons. First, the readability of the code. It is not
complex, but the work on readability is a continuous process. In other places
in the project, there are more complex methods that are better candidates for
division, but we have to start with something. Second, small methods have the
role of additional documentation. Third, this is just a practice that we follow
in my team and it is worth spreading it. This is not a new idea that does not
exist. This is the choice between two equivalent ways.
It is worth remembering that this is a small matter. This should not
prevent from merging, but only serve as a guide on how to write a code. If you
have time and you want it, you can improve it. This code is good enough to be
accepted without changes.
----------------------------------------------------------------
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