def run(self): """ Common collector cycle 1. Collect data 2. Sleep 3. Stop if object stopped """ # TODO: Standardize this with Managers. current_thread().name = self.short_name context.setup_thread_id() try: while True: context.inc_action_id() if self.object.running: self._collect() self._sleep() else: break context.teardown_thread_id() # Since kill signals won't work, we raise it ourselves. raise GreenletExit except GreenletExit: context.log.debug( '%s collector for %s received exit signal' % (self.__class__.__name__, self.object.definition_hash)) except: context.log.error('%s collector run failed' % self.object.definition_hash, exc_info=True) raise
def stop(self): self.server.close() context.teardown_thread_id() super(SyslogListener, self).stop()
def stop(self): # TODO: Think about whether or not this is necessary. Managers should probably be receiving thread.kill(). context.teardown_thread_id() self.running = False
def stop(self): self.running = False context.teardown_thread_id()