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_r218224171
##########
File path: airflow/models.py
##########
@@ -1744,6 +1749,29 @@ def dry_run(self):
self.render_templates()
task_copy.dry_run()
+ @provide_session
+ def handle_reschedule(self, reschedule_exception, test_mode=False,
context=None,
+ session=None):
+ self.end_date = timezone.utcnow()
+ self.set_duration()
+
+ # Log reschedule request
+ session.add(TaskReschedule(self.task, self.execution_date,
self._try_number,
+ self.start_date, self.end_date,
+ reschedule_exception.reschedule_date))
+
+ # set state
+ self.state = State.NONE
+
+ # Decrement try_number so subsequent runs will use the same try number
and write
+ # to same log file.
+ self._try_number -= 1
+
+ if not test_mode:
+ session.merge(self)
+ session.commit()
Review comment:
and do we want to put `session.commit()` under `if not test_mode` block as
well?
----------------------------------------------------------------
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