本文整理匯總了Python中pykka.ActorRegistry.get_all方法的典型用法代碼示例。如果您正苦於以下問題:Python ActorRegistry.get_all方法的具體用法?Python ActorRegistry.get_all怎麽用?Python ActorRegistry.get_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pykka.ActorRegistry
的用法示例。
在下文中一共展示了ActorRegistry.get_all方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_actor_may_be_unregistered_multiple_times_without_error
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.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())
示例2: test_actor_may_be_registered_manually
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.ActorRegistry import get_all [as 別名]
def test_actor_may_be_registered_manually(actor_ref):
ActorRegistry.unregister(actor_ref)
assert actor_ref not in ActorRegistry.get_all()
ActorRegistry.register(actor_ref)
assert actor_ref in ActorRegistry.get_all()
示例3: test_all_actors_are_stopped_on_base_exception
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.ActorRegistry import get_all [as 別名]
def test_all_actors_are_stopped_on_base_exception(events, actor_ref):
assert len(ActorRegistry.get_all()) == 1
assert not events.on_stop_was_called.is_set()
actor_ref.tell({'command': 'raise base exception'})
events.on_stop_was_called.wait(5)
assert events.on_stop_was_called.is_set()
assert len(ActorRegistry.get_all()) == 0
events.on_stop_was_called.wait(5)
assert events.on_stop_was_called.is_set()
assert len(ActorRegistry.get_all()) == 0
示例4: test_actor_processes_all_messages_before_stop_on_self_stops_it
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.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()))
示例5: test_actor_is_stopped_when_unhandled_exceptions_are_raised
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.ActorRegistry import get_all [as 別名]
def test_actor_is_stopped_when_unhandled_exceptions_are_raised(
actor_ref, events
):
assert not events.on_failure_was_called.is_set()
actor_ref.tell({'command': 'raise exception'})
events.on_failure_was_called.wait(5)
assert events.on_failure_was_called.is_set()
assert len(ActorRegistry.get_all()) == 0
示例6: test_actor_processes_all_messages_before_stop_on_self_stops_it
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.ActorRegistry import get_all [as 別名]
def test_actor_processes_all_messages_before_stop_on_self_stops_it(
actor_ref, events
):
actor_ref.ask({'command': 'message self then stop'})
events.greetings_was_received.wait(5)
assert events.greetings_was_received.is_set()
events.on_stop_was_called.wait(5)
assert len(ActorRegistry.get_all()) == 0
示例7: test_broadcast_sends_message_to_all_actors_if_no_target
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.ActorRegistry import get_all [as 別名]
def test_broadcast_sends_message_to_all_actors_if_no_target(
a_actor_refs, b_actor_refs
):
ActorRegistry.broadcast({'command': 'foo'})
running_actors = ActorRegistry.get_all()
assert running_actors
for actor_ref in running_actors:
received_messages = actor_ref.proxy().received_messages.get()
assert {'command': 'foo'} in received_messages
示例8: test_all_actors_are_stopped_on_base_exception
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.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()))
示例9: main
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.ActorRegistry import get_all [as 別名]
def main():
parser = argparse.ArgumentParser()
parser.add_argument('inputFiles',
nargs='+',
help='One or more reparsed log files [reParseLog.py]')
args = parser.parse_args()
flushCounter = 0
distributorListener = startSystem()
for inputFile in args.inputFiles:
with open(inputFile, 'r') as data:
print('Playing:', inputFile, 'flushCounter, distributorListener =',
flushCounter, distributorListener)
jsonData = json.load(data)
flushCounter, distributorListener = procesTweetStream(
jsonData, flushCounter, distributorListener)
distributorListener.flush().get()
distributorListener.stop()
for i in ActorRegistry.get_all():
i.stop()
示例10: test_actor_may_be_registered_manually
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.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())
示例11: test_actor_is_unregistered_when_stopped
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.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())
示例12: test_actor_is_registered_when_started
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.ActorRegistry import get_all [as 別名]
def test_actor_is_registered_when_started(self):
self.assert_(self.ref in ActorRegistry.get_all())
示例13: test_all_actors_can_be_stopped_through_registry
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.ActorRegistry import get_all [as 別名]
def test_all_actors_can_be_stopped_through_registry(a_actor_refs, b_actor_refs):
assert len(ActorRegistry.get_all()) == 8
ActorRegistry.stop_all(block=True)
assert len(ActorRegistry.get_all()) == 0
示例14: test_actor_is_registered_when_started
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.ActorRegistry import get_all [as 別名]
def test_actor_is_registered_when_started(actor_ref):
assert actor_ref in ActorRegistry.get_all()
示例15: test_actor_is_stopped_when_unhandled_exceptions_are_raised
# 需要導入模塊: from pykka import ActorRegistry [as 別名]
# 或者: from pykka.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()))