feng-tao commented on a change in pull request #3596: [AIRFLOW-2747] Explicit 
re-schedule of sensors
URL: https://github.com/apache/incubator-airflow/pull/3596#discussion_r218225205
 
 

 ##########
 File path: airflow/sensors/base_sensor_operator.py
 ##########
 @@ -65,6 +89,11 @@ def poke(self, context):
 
     def execute(self, context):
         started_at = timezone.utcnow()
+        if self.reschedule:
+            # If reschedule, use first start date of current try
+            task_reschedules = 
TaskReschedule.find_for_task_instance(context['ti'])
+            if task_reschedules:
+                started_at = task_reschedules[0].start_date
         while not self.poke(context):
             if (timezone.utcnow() - started_at).total_seconds() > self.timeout:
 
 Review comment:
   maybe a dump question, but now is it possible to have `(timezone.utcnow() - 
started_at)` as negative datetime number? will `(timezone.utcnow() - 
started_at).total_seconds()` throw exception?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to