From commits-return-22092-archive-asf-public=cust-asf.ponee.io@airflow.incubator.apache.org Mon Sep 17 22:42:45 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 937851807AC for ; Mon, 17 Sep 2018 22:42:43 +0200 (CEST) Received: (qmail 5074 invoked by uid 500); 17 Sep 2018 20:42:42 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 4498 invoked by uid 99); 17 Sep 2018 20:42:42 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Sep 2018 20:42:42 +0000 From: GitBox To: commits@airflow.apache.org Subject: [GitHub] feng-tao commented on a change in pull request #3596: [AIRFLOW-2747] Explicit re-schedule of sensors Message-ID: <153721696168.18196.16827381954504212417.gitbox@gitbox.apache.org> Date: Mon, 17 Sep 2018 20:42:41 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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