Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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()
Ejemplo n.º 3
0
 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())
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 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())
Ejemplo n.º 6
0
 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()
Ejemplo n.º 7
0
 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()
Ejemplo n.º 8
0
    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)
Ejemplo n.º 9
0
 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())
Ejemplo n.º 10
0
 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())
Ejemplo n.º 11
0
 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())
Ejemplo n.º 12
0
 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())