def scheduler_triggers(self, ctx): LOG.debug('Processing next Scheduler triggers.') for trigger in sched.get_next_triggers(): wb = db_api.workbook_get(trigger['workbook_name']) context.set_ctx(trusts.create_context(wb)) try: task = parser.get_workbook( wb['definition']).get_trigger_task_name(trigger['name']) self.engine.start_workflow_execution(wb['name'], task) finally: sched.set_next_execution_time(trigger) context.set_ctx(None)
def test_trigger_create_and_update(self): base = datetime(2010, 8, 25) next_trigger = datetime(2010, 8, 25, 0, 5) trigger = s.create_trigger("test", "*/5 * * * *", self.wb_name, base) self.assertEqual(trigger['next_execution_time'], next_trigger) trigger = s.set_next_execution_time(trigger) next_trigger = datetime(2010, 8, 25, 0, 10) self.assertEqual(trigger['next_execution_time'], next_trigger)