def _run_scheduler(): LOG.info('(PID=%s) Scheduler started.', os.getpid()) # Lazy load these so that decorator metrics are in place from st2actions.scheduler import (handler as scheduler_handler, entrypoint as scheduler_entrypoint) handler = scheduler_handler.get_handler() entrypoint = scheduler_entrypoint.get_scheduler_entrypoint() # TODO: Remove this try block for _cleanup_policy_delayed in v3.2. # This is a temporary cleanup to remove executions in deprecated policy-delayed status. try: handler._cleanup_policy_delayed() except Exception: LOG.exception( '(PID=%s) Scheduler unable to perform migration cleanup.', os.getpid()) # TODO: Remove this try block for _fix_missing_action_execution_id in v3.2. # This is a temporary fix to auto-populate action_execution_id. try: handler._fix_missing_action_execution_id() except Exception: LOG.exception( '(PID=%s) Scheduler unable to populate action_execution_id.', os.getpid()) try: handler.start() entrypoint.start() # Wait on handler first since entrypoint is more durable. handler.wait() or entrypoint.wait() except (KeyboardInterrupt, SystemExit): LOG.info('(PID=%s) Scheduler stopped.', os.getpid()) errors = False try: handler.shutdown() entrypoint.shutdown() except: LOG.exception('Unable to shutdown scheduler.') errors = True if errors: return 1 except: LOG.exception('(PID=%s) Scheduler unexpectedly stopped.', os.getpid()) try: handler.shutdown() entrypoint.shutdown() except: pass return 1 return 0
def _run_queuer(): LOG.info('(PID=%s) Scheduler started.', os.getpid()) # Lazy load these so that decorator metrics are in place from st2actions.scheduler import (handler as scheduler_handler, entrypoint as scheduler_entrypoint) handler = scheduler_handler.get_handler() entrypoint = scheduler_entrypoint.get_scheduler_entrypoint() try: handler.start() entrypoint.start() entrypoint.wait() except (KeyboardInterrupt, SystemExit): LOG.info('(PID=%s) Scheduler stopped.', os.getpid()) errors = False try: handler.shutdown() entrypoint.shutdown() except: LOG.exception('Unable to shutdown scheduler.') errors = True if errors: return 1 except: LOG.exception('(PID=%s) Scheduler unexpectedly stopped.', os.getpid()) return 1 return 0
def _run_scheduler(): LOG.info('(PID=%s) Scheduler started.', os.getpid()) # Lazy load these so that decorator metrics are in place from st2actions.scheduler import ( handler as scheduler_handler, entrypoint as scheduler_entrypoint ) handler = scheduler_handler.get_handler() entrypoint = scheduler_entrypoint.get_scheduler_entrypoint() # TODO: Remove this try block for _cleanup_policy_delayed in v3.2. # This is a temporary cleanup to remove executions in deprecated policy-delayed status. try: handler._cleanup_policy_delayed() except Exception: LOG.exception('(PID=%s) Scheduler unable to perform migration cleanup.', os.getpid()) # TODO: Remove this try block for _fix_missing_action_execution_id in v3.2. # This is a temporary fix to auto-populate action_execution_id. try: handler._fix_missing_action_execution_id() except Exception: LOG.exception('(PID=%s) Scheduler unable to populate action_execution_id.', os.getpid()) try: handler.start() entrypoint.start() # Wait on handler first since entrypoint is more durable. handler.wait() or entrypoint.wait() except (KeyboardInterrupt, SystemExit): LOG.info('(PID=%s) Scheduler stopped.', os.getpid()) errors = False try: handler.shutdown() entrypoint.shutdown() except: LOG.exception('Unable to shutdown scheduler.') errors = True if errors: return 1 except: LOG.exception('(PID=%s) Scheduler unexpectedly stopped.', os.getpid()) try: handler.shutdown() entrypoint.shutdown() except: pass return 1 return 0
def _run_scheduler(): LOG.info('(PID=%s) Scheduler started.', os.getpid()) # Lazy load these so that decorator metrics are in place from st2actions.scheduler import ( handler as scheduler_handler, entrypoint as scheduler_entrypoint ) handler = scheduler_handler.get_handler() entrypoint = scheduler_entrypoint.get_scheduler_entrypoint() try: handler.start() entrypoint.start() # Wait on handler first since entrypoint is more durable. handler.wait() or entrypoint.wait() except (KeyboardInterrupt, SystemExit): LOG.info('(PID=%s) Scheduler stopped.', os.getpid()) errors = False try: handler.shutdown() entrypoint.shutdown() except: LOG.exception('Unable to shutdown scheduler.') errors = True if errors: return 1 except: LOG.exception('(PID=%s) Scheduler unexpectedly stopped.', os.getpid()) try: handler.shutdown() entrypoint.shutdown() except: pass return 1 return 0
def process(cls, payload): ex_req = scheduling.get_scheduler_entrypoint().process(payload) if ex_req is not None: scheduling_queue.get_handler()._handle_execution(ex_req)
def process(cls, payload): scheduling.get_scheduler_entrypoint().process(payload)
def setUp(self): super(ActionExecutionSchedulingQueueItemDBTest, self).setUp() self.scheduler = scheduling.get_scheduler_entrypoint() self.scheduling_queue = scheduling_queue.get_handler()
def __init__(self, *args, **kwargs): super(QueueConsumerTest, self).__init__(*args, **kwargs) self.scheduler = scheduling.get_scheduler_entrypoint() self.scheduling_queue = scheduling_queue.get_handler() self.dispatcher = worker.get_worker()