From a7315f91ee13ac06679c579c3cf0a21e08a9363c Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 12 Jul 2018 16:20:38 -0400 Subject: [PATCH] Document per-func actors for clarity --- README.rst | 3 +++ tests/test_tractor.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/README.rst b/README.rst index f27f525..51b4010 100644 --- a/README.rst +++ b/README.rst @@ -267,12 +267,14 @@ actor and print the results to your screen: import tractor + # this is the first 2 actors, streamer_1 and streamer_2 async def stream_data(seed): for i in range(seed): yield i await trio.sleep(0) # trigger scheduler + # this is the third actor; the aggregator async def aggregate(seed): """Ensure that the two streams we receive match but only stream a single set of values to the parent. @@ -325,6 +327,7 @@ actor and print the results to your screen: print("AGGREGATOR COMPLETE!") + # this is the main actor and *arbiter* async def main(): # a nursery which spawns "actors" async with tractor.open_nursery() as nursery: diff --git a/tests/test_tractor.py b/tests/test_tractor.py index 8fbd22c..3ba273a 100644 --- a/tests/test_tractor.py +++ b/tests/test_tractor.py @@ -295,12 +295,14 @@ def test_cancel_single_subactor(arb_addr): tractor.run(main, arbiter_addr=arb_addr) +# this is the first 2 actors, streamer_1 and streamer_2 async def stream_data(seed): for i in range(seed): yield i await trio.sleep(0) # trigger scheduler +# this is the third actor; the aggregator async def aggregate(seed): """Ensure that the two streams we receive match but only stream a single set of values to the parent. @@ -352,6 +354,7 @@ async def aggregate(seed): print("AGGREGATOR COMPLETE!") +# this is the main actor and *arbiter* async def a_quadruple_example(): # a nursery which spawns "actors" async with tractor.open_nursery() as nursery: