Skip to content

Commit

Permalink
Document per-func actors for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Goodlet committed Jul 14, 2018
1 parent 1ca8cab commit e4f23ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion tests/test_tractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,14 @@ async def main():
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.
Expand Down Expand Up @@ -416,7 +418,7 @@ async def push_to_q(portal):
print("AGGREGATOR COMPLETE!")


# @tractor_test
# this is the main actor and *arbiter*
async def a_quadruple_example():
# a nursery which spawns "actors"
async with tractor.open_nursery() as nursery:
Expand Down

0 comments on commit e4f23ec

Please sign in to comment.