def __init__(self, *args, **kwargs): super(ZenEventD, self).__init__(*args, **kwargs) EventPipelineProcessor.SYNC_EVERY_EVENT = self.options.syncEveryEvent self._heartbeatSender = QueueHeartbeatSender('localhost', 'zeneventd', self.options.maintenancecycle *3) self._maintenanceCycle = MaintenanceCycle(self.options.maintenancecycle, self._heartbeatSender) objectEventNotify(DaemonCreatedEvent(self))
def __init__(self, *args, **kwargs): super(ZenEventD, self).__init__(*args, **kwargs) EventPipelineProcessor.SYNC_EVERY_EVENT = self.options.syncEveryEvent EventPipelineProcessor.PROCESS_EVENT_TIMEOUT = self.options.process_event_timeout self._heartbeatSender = QueueHeartbeatSender( 'localhost', 'zeneventd', self.options.heartbeatTimeout) self._maintenanceCycle = MaintenanceCycle( self.options.maintenancecycle, self._heartbeatSender) objectEventNotify(DaemonCreatedEvent(self)) config = ZenEventDConfig(self.options) provideUtility(config, IDaemonConfig, 'zeneventd_config')
def _startMaintenance(self, ignored=None): unused(ignored) if not self.options.cycle: self._maintenanceCycle() return if self.options.logTaskStats > 0: log.debug("Starting Task Stat logging") loop = task.LoopingCall(self._displayStatistics, verbose=True) loop.start(self.options.logTaskStats, now=False) interval = self.preferences.cycleInterval self.log.debug("Initializing maintenance Cycle") maintenanceCycle = MaintenanceCycle(interval, self, self._maintenanceCycle) maintenanceCycle.start()
def __init__(self): super(ZenActionD, self).__init__() self._consumer = None self._workers = ProcessWorkers(self.options.workers - 1, exec_worker, "zenactiond worker") self._heartbeatSender = QueueHeartbeatSender( 'localhost', 'zenactiond', self.options.heartbeatTimeout) self._maintenanceCycle = MaintenanceCycle( self.options.maintenancecycle, self._heartbeatSender) self._callHomeCycler = CallHomeCycler(self.dmd) self._schedule = Schedule(self.options, self.dmd) self._schedule.sendEvent = self.dmd.ZenEventManager.sendEvent self._schedule.monitor = self.options.monitor
class ZenEventD(ZCmdBase): def __init__(self, *args, **kwargs): super(ZenEventD, self).__init__(*args, **kwargs) EventPipelineProcessor.SYNC_EVERY_EVENT = self.options.syncEveryEvent self._heartbeatSender = QueueHeartbeatSender('localhost', 'zeneventd', self.options.maintenancecycle *3) self._maintenanceCycle = MaintenanceCycle(self.options.maintenancecycle, self._heartbeatSender) objectEventNotify(DaemonCreatedEvent(self)) config = ZenEventDConfig(self.options) provideUtility(config, IDaemonConfig, 'zeneventd_config') def sigTerm(self, signum=None, frame=None): log.info("Shutting down...") self._maintenanceCycle.stop() objectEventNotify(SigTermEvent(self)) super(ZenEventD, self).sigTerm(signum, frame) def run(self): if self.options.daemon or self.options.cycle: self._maintenanceCycle.start() objectEventNotify(DaemonStartRunEvent(self)) def sighandler_USR1(self, signum, frame): super(ZenEventD, self).sighandler_USR1(signum, frame) log.debug('sighandler_USR1 called %s' % signum) objectEventNotify(SigUsr1Event(self, signum)) def buildOptions(self): super(ZenEventD, self).buildOptions() maintenanceBuildOptions(self.parser) self.parser.add_option('--synceveryevent', dest='syncEveryEvent', action="store_true", default=False, help='Force sync() before processing every event; default is to sync() no more often ' 'than once every 1/2 second.') self.parser.add_option('--messagesperworker', dest='messagesPerWorker', default=1, type="int", help='Sets the number of messages each worker gets from the queue at any given time. Default is 1. ' 'Change this only if event processing is deemed slow. Note that increasing the value increases the ' 'probability that events will be processed out of order.') self.parser.add_option('--maxpickle', dest='maxpickle', default=100, type="int", help='Sets the number of pickle files in var/zeneventd/failed_transformed_events.') self.parser.add_option('--pickledir', dest='pickledir', default=zenPath('var/zeneventd/failed_transformed_events'), type="string", help='Sets the path to save pickle files.') objectEventNotify(BuildOptionsEvent(self))
def _startMaintenance(self, ignored=None): unused(ignored) if not self.options.cycle: self._maintenanceCycle() return if self.options.logTaskStats > 0: log.debug("Starting Task Stat logging") loop = task.LoopingCall(self._displayStatistics, verbose=True) loop.start(self.options.logTaskStats, now=False) log.debug("Starting Statistic posting") loop = task.LoopingCall(self._postStatistics) loop.start(self.options.writeStatistics, now=False) interval = self.preferences.cycleInterval self.log.debug("Initializing maintenance Cycle") heartbeatSender = self if self.worker_id == 0 else None maintenanceCycle = MaintenanceCycle(interval, heartbeatSender, self._maintenanceCycle) maintenanceCycle.start()
def __init__(self, *args, **kwargs): super(ZenEventD, self).__init__(*args, **kwargs) EventPipelineProcessor.SYNC_EVERY_EVENT = self.options.syncEveryEvent EventPipelineProcessor.PROCESS_EVENT_TIMEOUT = self.options.process_event_timeout self._heartbeatSender = QueueHeartbeatSender( 'localhost', 'zeneventd', self.options.heartbeatTimeout ) self._maintenanceCycle = MaintenanceCycle( self.options.maintenancecycle, self._heartbeatSender ) objectEventNotify(DaemonCreatedEvent(self)) config = ZenEventDConfig(self.options) provideUtility(config, IDaemonConfig, 'zeneventd_config')
class ZenEventD(ZCmdBase): def __init__(self, *args, **kwargs): super(ZenEventD, self).__init__(*args, **kwargs) EventPipelineProcessor.SYNC_EVERY_EVENT = self.options.syncEveryEvent self._heartbeatSender = QueueHeartbeatSender('localhost', 'zeneventd', self.options.maintenancecycle *3) self._maintenanceCycle = MaintenanceCycle(self.options.maintenancecycle, self._heartbeatSender) objectEventNotify(DaemonCreatedEvent(self)) def sigTerm(self, signum=None, frame=None): log.info("Shutting down...") self._maintenanceCycle.stop() objectEventNotify(SigTermEvent(self)) super(ZenEventD, self).sigTerm(signum, frame) def run(self): if self.options.daemon: self._maintenanceCycle.start() objectEventNotify(DaemonStartRunEvent(self)) def sighandler_USR1(self, signum, frame): super(ZenEventD, self).sighandler_USR1(signum, frame) log.debug('sighandler_USR1 called %s' % signum) objectEventNotify(SigUsr1Event(self, signum)) def buildOptions(self): super(ZenEventD, self).buildOptions() maintenanceBuildOptions(self.parser) self.parser.add_option('--synceveryevent', dest='syncEveryEvent', action="store_true", default=False, help='Force sync() before processing every event; default is to sync() no more often ' 'than once every 1/2 second.') objectEventNotify(BuildOptionsEvent(self))
def __init__(self): super(ZenActionD, self).__init__() self._consumer = None self._workers = ProcessWorkers(self.options.workers - 1, exec_worker, "zenactiond worker") self._heartbeatSender = QueueHeartbeatSender('localhost', 'zenactiond', self.options.maintenancecycle *3) self._maintenanceCycle = MaintenanceCycle(self.options.maintenancecycle, self._heartbeatSender) self._callHomeCycler = CallHomeCycler(self.dmd) self._schedule = Schedule(self.options, self.dmd) self._schedule.sendEvent = self.dmd.ZenEventManager.sendEvent self._schedule.monitor = self.options.monitor
class ZenActionD(ZCmdBase): def __init__(self): super(ZenActionD, self).__init__() self._consumer = None self._workers = ProcessWorkers(self.options.workers - 1, exec_worker, "zenactiond worker") self._heartbeatSender = QueueHeartbeatSender('localhost', 'zenactiond', self.options.maintenancecycle *3) self._maintenanceCycle = MaintenanceCycle(self.options.maintenancecycle, self._heartbeatSender) self._callHomeCycler = CallHomeCycler(self.dmd) self._schedule = Schedule(self.options, self.dmd) self._schedule.sendEvent = self.dmd.ZenEventManager.sendEvent self._schedule.monitor = self.options.monitor def buildOptions(self): super(ZenActionD, self).buildOptions() maintenanceBuildOptions(self.parser) workersBuildOptions(self.parser, 1) default_max_commands = 10 self.parser.add_option('--maxcommands', dest="maxCommands", type="int", default=default_max_commands, help='Max number of action commands to perform concurrently (default: %d)' % \ default_max_commands) default_url = getDefaultZopeUrl() self.parser.add_option('--zopeurl', dest='zopeurl', default=default_url, help="http path to the root of the zope server (default: %s)" % default_url) self.parser.add_option("--monitor", dest="monitor", default=DEFAULT_MONITOR, help="Name of monitor instance to use for heartbeat " " events. Default is %s." % DEFAULT_MONITOR) self.parser.add_option('--maintenance-window-cycletime', dest='maintenceWindowCycletime', default=60, type="int", help="How often to check to see if there are any maintenance windows to execute") def run(self): # Configure all actions with the command-line options self.abortIfWaiting() options_dict = dict(vars(self.options)) for name, action in getUtilitiesFor(IAction): action.configure(options_dict) dao = NotificationDao(self.dmd) task = ISignalProcessorTask(dao) self._callHomeCycler.start() self._schedule.start() # maintenance windows if self.options.daemon: self._maintenanceCycle.start() # heartbeats, etc. if self.options.daemon and self.options.workers > 1: self._workers.startWorkers() self._consumer = QueueConsumer(task, self.dmd) reactor.callWhenRunning(self._start) reactor.run() def abortIfWaiting(self): # If this process is doing nothing, abort the transaction to avoid long INNODB history try: transaction.abort() except Exception: pass reactor.callLater(30.0, self.abortIfWaiting) def _start(self): log.info('starting zenactiond consumer.') reactor.addSystemEventTrigger('before', 'shutdown', self._shutdown) self._consumer.run() @defer.inlineCallbacks def _shutdown(self, *ignored): log.info("Shutting down...") self._maintenanceCycle.stop() self._workers.shutdown() if self._consumer: yield self._consumer.shutdown()
class ZenActionD(ZCmdBase): def __init__(self): super(ZenActionD, self).__init__() self._consumer = None self._workers = ProcessWorkers(self.options.workers - 1, exec_worker, "zenactiond worker") self._heartbeatSender = QueueHeartbeatSender('localhost', 'zenactiond', self.options.maintenancecycle *3) self._maintenanceCycle = MaintenanceCycle(self.options.maintenancecycle, self._heartbeatSender) self._callHomeCycler = CallHomeCycler(self.dmd) self._schedule = Schedule(self.options, self.dmd) self._schedule.sendEvent = self.dmd.ZenEventManager.sendEvent self._schedule.monitor = self.options.monitor def buildOptions(self): super(ZenActionD, self).buildOptions() maintenanceBuildOptions(self.parser) workersBuildOptions(self.parser, 1) default_max_commands = 10 self.parser.add_option('--maxcommands', dest="maxCommands", type="int", default=default_max_commands, help='Max number of action commands to perform concurrently (default: %d)' % \ default_max_commands) default_url = getDefaultZopeUrl() self.parser.add_option('--zopeurl', dest='zopeurl', default=default_url, help="http path to the root of the zope server (default: %s)" % default_url) self.parser.add_option("--monitor", dest="monitor", default=DEFAULT_MONITOR, help="Name of monitor instance to use for heartbeat " " events. Default is %s." % DEFAULT_MONITOR) self.parser.add_option('--maintenance-window-cycletime', dest='maintenceWindowCycletime', default=60, type="int", help="How often to check to see if there are any maintenance windows to execute") def run(self): # Configure all actions with the command-line options options_dict = dict(vars(self.options)) for name, action in getUtilitiesFor(IAction): action.configure(options_dict) dao = NotificationDao(self.dmd) task = ISignalProcessorTask(dao) self._callHomeCycler.start() self._schedule.start() # maintenance windows if self.options.daemon: self._maintenanceCycle.start() # heartbeats, etc. if self.options.daemon and self.options.workers > 1: self._workers.startWorkers() self._consumer = QueueConsumer(task, self.dmd) reactor.callWhenRunning(self._start) reactor.run() def _start(self): log.info('starting zenactiond consumer.') reactor.addSystemEventTrigger('before', 'shutdown', self._shutdown) self._consumer.run() @defer.inlineCallbacks def _shutdown(self, *ignored): log.info("Shutting down...") self._maintenanceCycle.stop() self._workers.shutdown() if self._consumer: yield self._consumer.shutdown()
class ZenActionD(ZCmdBase): MSGS_TO_PREFETCH = 1 def __init__(self): super(ZenActionD, self).__init__() self._consumer = None self._workers = ProcessWorkers(self.options.workers - 1, exec_worker, "zenactiond worker") self._heartbeatSender = QueueHeartbeatSender('localhost', 'zenactiond', self.options.heartbeatTimeout) self._maintenanceCycle = MaintenanceCycle(self.options.maintenancecycle, self._heartbeatSender) self._callHomeCycler = CallHomeCycler(self.dmd) self._schedule = Schedule(self.options, self.dmd) self._schedule.sendEvent = self.dmd.ZenEventManager.sendEvent self._schedule.monitor = self.options.monitor def buildOptions(self): super(ZenActionD, self).buildOptions() maintenanceBuildOptions(self.parser) workersBuildOptions(self.parser, 1) default_max_commands = 10 self.parser.add_option('--maxcommands', dest="maxCommands", type="int", default=default_max_commands, help='Max number of action commands to perform concurrently (default: %d)' % \ default_max_commands) default_max_pagingworkers = 1 self.parser.add_option('--maxpagingworkers', dest="maxPagingWorkers", type="int", default=default_max_pagingworkers, help='max number of paging workers to perform concurrently (default: %d)' % \ default_max_pagingworkers) default_pagingworkers_timeout = 30 self.parser.add_option('--pagingworkerstimeout', dest="pagingWorkersTimeout", type="int", default=default_pagingworkers_timeout, help='Timeout, in seconds, for paging workers (default: %d)' % \ default_pagingworkers_timeout) default_url = getDefaultZopeUrl() self.parser.add_option('--zopeurl', dest='zopeurl', default=default_url, help="http path to the root of the zope server (default: %s)" % default_url) self.parser.add_option("--monitor", dest="monitor", default=DEFAULT_MONITOR, help="Name of monitor instance to use for heartbeat " " events. Default is %s." % DEFAULT_MONITOR) self.parser.add_option('--maintenance-window-cycletime', dest='maintenceWindowCycletime', default=60, type="int", help="How often to check to see if there are any maintenance windows to execute") self.parser.add_option('--maintenance-window-batch-size', dest='maintenceWindowBatchSize', default=200, type="int", help="How many devices update per one transaction on maintenance windows execution") self.parser.add_option('--strip-email-body-tags', dest='stripEmailBodyTags', default=True, action="store_false", help="Strip HTML/XML tags from plaintext email notifications?") self.parser.add_option("--workerid", dest='workerid', type='int', default=None, help="ID of the worker instance.") def run(self): # Configure all actions with the command-line options self.abortIfWaiting() options_dict = dict(vars(self.options)) for name, action in getUtilitiesFor(IAction): action.configure(options_dict) dao = NotificationDao(self.dmd) task = ISignalProcessorTask(dao) metric_destination = os.environ.get("CONTROLPLANE_CONSUMER_URL", "") if metric_destination == "": metric_destination = "http://localhost:22350/api/metrics/store" username = os.environ.get("CONTROLPLANE_CONSUMER_USERNAME", "") password = os.environ.get("CONTROLPLANE_CONSUMER_PASSWORD", "") pub = publisher.HttpPostPublisher(username, password, metric_destination) log.debug("Creating async MetricReporter") daemonTags = { 'zenoss_daemon': 'zenactiond', 'internal': True } self.metricreporter = TwistedMetricReporter(prefix='zenoss.', metricWriter=MetricWriter(pub), tags=daemonTags) self.metricreporter.start() reactor.addSystemEventTrigger('before', 'shutdown', self.metricreporter.stop) if self.options.workerid == 0 and (self.options.daemon or self.options.cycle): self._callHomeCycler.start() self._schedule.start() # maintenance windows if self.options.daemon or self.options.cycle: self._maintenanceCycle.start() # heartbeats, etc. if (self.options.daemon or self.options.cycle) and self.options.workers > 1: self._workers.startWorkers() self._consumer = QueueConsumer(task, self.dmd) reactor.callWhenRunning(self._start) reactor.run() def abortIfWaiting(self): # If this process is doing nothing, abort the transaction to avoid long INNODB history try: transaction.abort() except Exception: pass reactor.callLater(30.0, self.abortIfWaiting) def _start(self): log.info('starting zenactiond consumer.') reactor.addSystemEventTrigger('before', 'shutdown', self._shutdown) self._consumer.run() @defer.inlineCallbacks def _shutdown(self, *ignored): log.info("Shutting down...") self._maintenanceCycle.stop() self._workers.shutdown() if self._consumer: yield self._consumer.shutdown()
class ZenActionD(ZCmdBase): MSGS_TO_PREFETCH = 1 def __init__(self): super(ZenActionD, self).__init__() self._consumer = None self._workers = ProcessWorkers(self.options.workers - 1, exec_worker, "zenactiond worker") self._heartbeatSender = QueueHeartbeatSender( 'localhost', 'zenactiond', self.options.heartbeatTimeout) self._maintenanceCycle = MaintenanceCycle( self.options.maintenancecycle, self._heartbeatSender) self._callHomeCycler = CallHomeCycler(self.dmd) self._schedule = Schedule(self.options, self.dmd) self._schedule.sendEvent = self.dmd.ZenEventManager.sendEvent self._schedule.monitor = self.options.monitor def buildOptions(self): super(ZenActionD, self).buildOptions() maintenanceBuildOptions(self.parser) workersBuildOptions(self.parser, 1) default_max_commands = 10 self.parser.add_option('--maxcommands', dest="maxCommands", type="int", default=default_max_commands, help='Max number of action commands to perform concurrently (default: %d)' % \ default_max_commands) default_max_pagingworkers = 1 self.parser.add_option('--maxpagingworkers', dest="maxPagingWorkers", type="int", default=default_max_pagingworkers, help='max number of paging workers to perform concurrently (default: %d)' % \ default_max_pagingworkers) default_pagingworkers_timeout = 30 self.parser.add_option('--pagingworkerstimeout', dest="pagingWorkersTimeout", type="int", default=default_pagingworkers_timeout, help='Timeout, in seconds, for paging workers (default: %d)' % \ default_pagingworkers_timeout) default_url = getDefaultZopeUrl() self.parser.add_option( '--zopeurl', dest='zopeurl', default=default_url, help="http path to the root of the zope server (default: %s)" % default_url) self.parser.add_option( "--monitor", dest="monitor", default=DEFAULT_MONITOR, help="Name of monitor instance to use for heartbeat " " events. Default is %s." % DEFAULT_MONITOR) self.parser.add_option( '--maintenance-window-cycletime', dest='maintenceWindowCycletime', default=60, type="int", help= "How often to check to see if there are any maintenance windows to execute" ) self.parser.add_option( '--maintenance-window-batch-size', dest='maintenceWindowBatchSize', default=200, type="int", help= "How many devices update per one transaction on maintenance windows execution" ) self.parser.add_option( '--strip-email-body-tags', dest='stripEmailBodyTags', default=True, action="store_false", help="Strip HTML/XML tags from plaintext email notifications?") self.parser.add_option("--workerid", dest='workerid', type='int', default=None, help="ID of the worker instance.") def run(self): # Configure all actions with the command-line options self.abortIfWaiting() options_dict = dict(vars(self.options)) for name, action in getUtilitiesFor(IAction): action.configure(options_dict) dao = NotificationDao(self.dmd) task = ISignalProcessorTask(dao) metric_destination = os.environ.get("CONTROLPLANE_CONSUMER_URL", "") if metric_destination == "": metric_destination = "http://localhost:22350/api/metrics/store" username = os.environ.get("CONTROLPLANE_CONSUMER_USERNAME", "") password = os.environ.get("CONTROLPLANE_CONSUMER_PASSWORD", "") pub = publisher.HttpPostPublisher(username, password, metric_destination) log.debug("Creating async MetricReporter") daemonTags = {'zenoss_daemon': 'zenactiond', 'internal': True} self.metricreporter = TwistedMetricReporter( prefix='zenoss.', metricWriter=MetricWriter(pub), tags=daemonTags) self.metricreporter.start() reactor.addSystemEventTrigger('before', 'shutdown', self.metricreporter.stop) if self.options.workerid == 0 and (self.options.daemon or self.options.cycle): self._callHomeCycler.start() self._schedule.start() # maintenance windows if self.options.daemon or self.options.cycle: self._maintenanceCycle.start() # heartbeats, etc. if (self.options.daemon or self.options.cycle) and self.options.workers > 1: self._workers.startWorkers() self._consumer = QueueConsumer(task, self.dmd) reactor.callWhenRunning(self._start) reactor.run() def abortIfWaiting(self): # If this process is doing nothing, abort the transaction to avoid long INNODB history try: transaction.abort() except Exception: pass reactor.callLater(30.0, self.abortIfWaiting) def _start(self): log.info('starting zenactiond consumer.') reactor.addSystemEventTrigger('before', 'shutdown', self._shutdown) self._consumer.run() @defer.inlineCallbacks def _shutdown(self, *ignored): log.info("Shutting down...") self._maintenanceCycle.stop() self._workers.shutdown() if self._consumer: yield self._consumer.shutdown()
class ZenActionD(ZCmdBase): MSGS_TO_PREFETCH = 1 def __init__(self): super(ZenActionD, self).__init__() self._consumer = None self._workers = ProcessWorkers(self.options.workers - 1, exec_worker, "zenactiond worker") self._heartbeatSender = QueueHeartbeatSender( 'localhost', 'zenactiond', self.options.maintenancecycle * 3) self._maintenanceCycle = MaintenanceCycle( self.options.maintenancecycle, self._heartbeatSender) self._callHomeCycler = CallHomeCycler(self.dmd) self._schedule = Schedule(self.options, self.dmd) self._schedule.sendEvent = self.dmd.ZenEventManager.sendEvent self._schedule.monitor = self.options.monitor def buildOptions(self): super(ZenActionD, self).buildOptions() maintenanceBuildOptions(self.parser) workersBuildOptions(self.parser, 1) default_max_commands = 10 self.parser.add_option('--maxcommands', dest="maxCommands", type="int", default=default_max_commands, help='Max number of action commands to perform concurrently (default: %d)' % \ default_max_commands) default_max_pagingworkers = 1 self.parser.add_option('--maxpagingworkers', dest="maxPagingWorkers", type="int", default=default_max_pagingworkers, help='max number of paging workers to perform concurrently (default: %d)' % \ default_max_pagingworkers) default_pagingworkers_timeout = 30 self.parser.add_option('--pagingworkerstimeout', dest="pagingWorkersTimeout", type="int", default=default_pagingworkers_timeout, help='Timeout, in seconds, for paging workers (default: %d)' % \ default_pagingworkers_timeout) default_url = getDefaultZopeUrl() self.parser.add_option( '--zopeurl', dest='zopeurl', default=default_url, help="http path to the root of the zope server (default: %s)" % default_url) self.parser.add_option( "--monitor", dest="monitor", default=DEFAULT_MONITOR, help="Name of monitor instance to use for heartbeat " " events. Default is %s." % DEFAULT_MONITOR) self.parser.add_option( '--maintenance-window-cycletime', dest='maintenceWindowCycletime', default=60, type="int", help= "How often to check to see if there are any maintenance windows to execute" ) self.parser.add_option("--workerid", dest='workerid', type='int', default=None, help="ID of the worker instance.") def run(self): # Configure all actions with the command-line options self.abortIfWaiting() options_dict = dict(vars(self.options)) for name, action in getUtilitiesFor(IAction): action.configure(options_dict) dao = NotificationDao(self.dmd) task = ISignalProcessorTask(dao) if self.options.workerid == 0 and (self.options.daemon or self.options.cycle): self._callHomeCycler.start() self._schedule.start() # maintenance windows if self.options.daemon or self.options.cycle: self._maintenanceCycle.start() # heartbeats, etc. if (self.options.daemon or self.options.cycle) and self.options.workers > 1: self._workers.startWorkers() self._consumer = QueueConsumer(task, self.dmd) reactor.callWhenRunning(self._start) reactor.run() def abortIfWaiting(self): # If this process is doing nothing, abort the transaction to avoid long INNODB history try: transaction.abort() except Exception: pass reactor.callLater(30.0, self.abortIfWaiting) def _start(self): log.info('starting zenactiond consumer.') reactor.addSystemEventTrigger('before', 'shutdown', self._shutdown) self._consumer.run() @defer.inlineCallbacks def _shutdown(self, *ignored): log.info("Shutting down...") self._maintenanceCycle.stop() self._workers.shutdown() if self._consumer: yield self._consumer.shutdown()