def _handle_failure(self, exception_type, exception_value, traceback): """Logs unexpected failures, unregisters and stops the actor.""" _logger.error('Unhandled exception in %s:' % self, exc_info=(exception_type, exception_value, traceback)) _ActorRegistry.unregister(self.actor_ref) self._actor_runnable = False self.on_failure(exception_type, exception_value, traceback)
def _handle_failure(self, exception_type, exception_value, traceback): """Logs unexpected failures, unregisters and stops the actor.""" logger.error( 'Unhandled exception in %s:' % self, exc_info=(exception_type, exception_value, traceback)) ActorRegistry.unregister(self.actor_ref) self.actor_stopped.set()
def test_actor_may_be_unregistered_multiple_times_without_error(self): ActorRegistry.unregister(self.ref) self.assert_(self.ref not in ActorRegistry.get_all()) ActorRegistry.unregister(self.ref) self.assert_(self.ref not in ActorRegistry.get_all()) ActorRegistry.register(self.ref) self.assert_(self.ref in ActorRegistry.get_all())
def _handle_failure(self, exception_type, exception_value, traceback): """Logs unexpected failures, unregisters and stops the actor.""" _logger.error( 'Unhandled exception in %s:' % self, exc_info=(exception_type, exception_value, traceback)) _ActorRegistry.unregister(self.actor_ref) self._actor_runnable = False
def _stop(self): """ Stops the actor immediately without processing the rest of the inbox. """ _ActorRegistry.unregister(self.actor_ref) self._actor_runnable = False _logger.debug('Stopped %s', self) self.on_stop()
def stop(self): """ Stop the actor. The actor will finish processing any messages already in its queue before stopping. It may not be restarted. """ self.actor_runnable = False ActorRegistry.unregister(self.actor_ref) logger.debug(u'Stopped %s', self)
def _stop(self): """ Stops the actor immediately without processing the rest of the inbox. """ ActorRegistry.unregister(self.actor_ref) self.actor_stopped.set() logger.debug('Stopped %s', self) try: self.on_stop() except Exception: self._handle_failure(*sys.exc_info())
def _stop(self): """ Stops the actor immediately without processing the rest of the inbox. """ _ActorRegistry.unregister(self.actor_ref) self._actor_runnable = False _logger.debug('Stopped %s', self) try: self.on_stop() except Exception: self._handle_failure(*_sys.exc_info())
def test_actor_may_be_registered_manually(self): ActorRegistry.unregister(self.ref) self.assert_(self.ref not in ActorRegistry.get_all()) ActorRegistry.register(self.ref) self.assert_(self.ref in ActorRegistry.get_all())