airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] feng-tao commented on a change in pull request #3596: [AIRFLOW-2747] Explicit re-schedule of sensors
Date Mon, 17 Sep 2018 20:42:41 GMT
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_r218217372
 
 

 ##########
 File path: airflow/sensors/base_sensor_operator.py
 ##########
 @@ -75,11 +104,24 @@ def execute(self, context):
                     raise AirflowSkipException('Snap. Time is OUT.')
                 else:
                     raise AirflowSensorTimeout('Snap. Time is OUT.')
-            sleep(self.poke_interval)
+            if self.reschedule:
+                reschedule_date = timezone.utcnow() + timedelta(
+                    seconds=self.poke_interval)
+                raise AirflowRescheduleException(reschedule_date)
+            else:
+                sleep(self.poke_interval)
         self.log.info("Success criteria met. Exiting.")
 
     def _do_skip_downstream_tasks(self, context):
         downstream_tasks = context['task'].get_flat_relatives(upstream=False)
         self.log.debug("Downstream task_ids %s", downstream_tasks)
         if downstream_tasks:
             self.skip(context['dag_run'], context['ti'].execution_date, downstream_tasks)
+
+    @property
+    def reschedule(self):
+        return self.mode == 'reschedule'
+
+    @property
+    def deps(self):
 
 Review comment:
   could you add a comment on what is this dependency for?

----------------------------------------------------------------
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