airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] seelmann commented on a change in pull request #3596: [AIRFLOW-2747] Explicit re-schedule of sensors
Date Tue, 18 Sep 2018 19:40:53 GMT
seelmann 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_r218567791
 
 

 ##########
 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:
   Normally that should not be the case because `started_at` is always in the past. Of course
clocks are never in sync (except at Google) so it may happen. But also in such a case `datetime.timedelta.total_seconds()`
doesn't throw an exception but returns a negative number which is still smaller than the configured
timeout (if the user configured a positive timeout, lol)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message