示例#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)
示例#2
0
文件: actor.py 项目: 0xD3ADB33F/pykka
 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()
示例#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())
示例#4
0
文件: actor.py 项目: jstasiak/pykka
 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
示例#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())
示例#6
0
文件: actor.py 项目: davisein/pykka
 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()
示例#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()
示例#8
0
文件: actor.py 项目: flaper87/pykka
    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)
示例#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())
示例#10
0
文件: actor.py 项目: jstasiak/pykka
 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())
示例#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())
示例#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())