当前位置: 首页>>代码示例>>Python>>正文


Python ActorRegistry.get_all方法代码示例

本文整理汇总了Python中pykka.registry.ActorRegistry.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python ActorRegistry.get_all方法的具体用法?Python ActorRegistry.get_all怎么用?Python ActorRegistry.get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pykka.registry.ActorRegistry的用法示例。


在下文中一共展示了ActorRegistry.get_all方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_actor_may_be_unregistered_multiple_times_without_error

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
 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())
开发者ID:benjixx,项目名称:pykka,代码行数:9,代码来源:registry_test.py

示例2: stop_all_actors

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
def stop_all_actors():
    num_actors = len(ActorRegistry.get_all())
    while num_actors:
        logger.debug(u'Seeing %d actor and %d non-actor thread(s): %s',
            num_actors, threading.active_count() - num_actors,
            ', '.join([t.name for t in threading.enumerate()]))
        logger.debug(u'Stopping %d actor(s)...', num_actors)
        ActorRegistry.stop_all()
        num_actors = len(ActorRegistry.get_all())
    logger.debug(u'All actors stopped.')
开发者ID:Amli,项目名称:mopidy,代码行数:12,代码来源:process.py

示例3: stop_remaining_actors

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
def stop_remaining_actors():
    num_actors = len(ActorRegistry.get_all())
    while num_actors:
        logger.error(
            u'There are actor threads still running, this is probably a bug')
        logger.debug(u'Seeing %d actor and %d non-actor thread(s): %s',
            num_actors, threading.active_count() - num_actors,
            ', '.join([t.name for t in threading.enumerate()]))
        logger.debug(u'Stopping %d actor(s)...', num_actors)
        ActorRegistry.stop_all()
        num_actors = len(ActorRegistry.get_all())
    logger.debug(u'All actors stopped.')
开发者ID:Dvad,项目名称:mopidy,代码行数:14,代码来源:process.py

示例4: test_all_actors_are_stopped_on_base_exception

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
    def test_all_actors_are_stopped_on_base_exception(self):
        start_event = self.event_class()
        stop_event = self.event_class()
        fail_event = self.event_class()
        registered_event = self.event_class()
        another_actor = self.AnActor.start(start_event, stop_event, fail_event,
            registered_event)

        self.assertEqual(2, len(ActorRegistry.get_all()))
        self.assertFalse(self.on_stop_was_called.is_set())
        self.actor_ref.send_one_way({'command': 'raise base exception'})
        self.on_stop_was_called.wait()
        self.assert_(1 >= len(ActorRegistry.get_all()))
        stop_event.wait()
        self.assertEqual(0, len(ActorRegistry.get_all()))
开发者ID:okoye,项目名称:pykka,代码行数:17,代码来源:actor_test.py

示例5: test_actor_processes_all_messages_before_stop_on_self_stops_it

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
    def test_actor_processes_all_messages_before_stop_on_self_stops_it(self):
        self.actor_ref.ask({'command': 'message self then stop'})

        self.greetings_was_received.wait(5)
        self.assertTrue(self.greetings_was_received.is_set())

        self.on_stop_was_called.wait(5)

        self.assertEqual(0, len(ActorRegistry.get_all()))
开发者ID:davisein,项目名称:pykka,代码行数:11,代码来源:actor_test.py

示例6: test_all_actors_are_stopped_on_base_exception

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
    def test_all_actors_are_stopped_on_base_exception(self):
        start_event = self.event_class()
        stop_event = self.event_class()
        fail_event = self.event_class()
        registered_event = self.event_class()
        greetings_event = self.event_class()
        self.AnActor.start(
            on_start_was_called=start_event,
            on_stop_was_called=stop_event,
            on_failure_was_called=fail_event,
            actor_was_registered_before_on_start_was_called=registered_event,
            greetings_was_received=greetings_event)

        self.assertEqual(2, len(ActorRegistry.get_all()))
        self.assertFalse(self.on_stop_was_called.is_set())
        self.actor_ref.tell({'command': 'raise base exception'})
        self.on_stop_was_called.wait(5)
        self.assertTrue(self.on_stop_was_called.is_set())
        self.assert_(1 >= len(ActorRegistry.get_all()))
        stop_event.wait(5)
        self.assertTrue(stop_event.is_set())
        self.assertEqual(0, len(ActorRegistry.get_all()))
开发者ID:davisein,项目名称:pykka,代码行数:24,代码来源:actor_test.py

示例7: test_actor_is_stopped_when_unhandled_exceptions_are_raised

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
 def test_actor_is_stopped_when_unhandled_exceptions_are_raised(self):
     self.assertFalse(self.on_failure_was_called.is_set())
     self.actor_ref.tell({'command': 'raise exception'})
     self.on_failure_was_called.wait(5)
     self.assertTrue(self.on_failure_was_called.is_set())
     self.assertEqual(0, len(ActorRegistry.get_all()))
开发者ID:PabloTunnon,项目名称:pykka-deb,代码行数:8,代码来源:actor_test.py

示例8: test_broadcast_sends_message_to_all_actors_if_no_target

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
 def test_broadcast_sends_message_to_all_actors_if_no_target(self):
     ActorRegistry.broadcast({'command': 'foo'})
     for actor_ref in ActorRegistry.get_all():
         received_messages = actor_ref.proxy().received_messages.get()
         self.assert_({'command': 'foo'} in received_messages)
开发者ID:benjixx,项目名称:pykka,代码行数:7,代码来源:registry_test.py

示例9: test_all_actors_can_be_stopped_through_registry

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
 def test_all_actors_can_be_stopped_through_registry(self):
     self.assertEquals(9, len(ActorRegistry.get_all()))
     ActorRegistry.stop_all(block=True)
     self.assertEquals(0, len(ActorRegistry.get_all()))
开发者ID:benjixx,项目名称:pykka,代码行数:6,代码来源:registry_test.py

示例10: test_actor_may_be_registered_manually

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
 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())
开发者ID:benjixx,项目名称:pykka,代码行数:7,代码来源:registry_test.py

示例11: test_actor_is_unregistered_when_stopped

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
 def test_actor_is_unregistered_when_stopped(self):
     self.assert_(self.ref in ActorRegistry.get_all())
     self.ref.stop()
     self.assert_(self.ref not in ActorRegistry.get_all())
开发者ID:benjixx,项目名称:pykka,代码行数:6,代码来源:registry_test.py

示例12: test_actor_is_registered_when_started

# 需要导入模块: from pykka.registry import ActorRegistry [as 别名]
# 或者: from pykka.registry.ActorRegistry import get_all [as 别名]
 def test_actor_is_registered_when_started(self):
     self.assert_(self.ref in ActorRegistry.get_all())
开发者ID:benjixx,项目名称:pykka,代码行数:4,代码来源:registry_test.py


注:本文中的pykka.registry.ActorRegistry.get_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。