Skip to content

Commit

Permalink
Add logging and teardown prints to full-fledged-streaming example
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Nov 6, 2022
1 parent 7b9464e commit 45fac17
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions examples/full_fledged_streaming_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ async def stream_data(seed):

# this is the third actor; the aggregator
async def aggregate(seed):
"""Ensure that the two streams we receive match but only stream
'''
Ensure that the two streams we receive match but only stream
a single set of values to the parent.
"""
'''
async with tractor.open_nursery() as nursery:
portals = []
for i in range(1, 3):
Expand Down Expand Up @@ -69,7 +71,8 @@ async def push_to_chan(portal, send_chan):
async def main():
# a nursery which spawns "actors"
async with tractor.open_nursery(
arbiter_addr=('127.0.0.1', 1616)
arbiter_addr=('127.0.0.1', 1616),
loglevel='cancel',
) as nursery:

seed = int(1e3)
Expand All @@ -92,6 +95,9 @@ async def main():
async for value in stream:
result_stream.append(value)

print("ROOT STREAM CONSUMER COMPLETE")

print("ROOT CANCELLING AGGREGATOR CHILD")
await portal.cancel_actor()

print(f"STREAM TIME = {time.time() - start}")
Expand Down

0 comments on commit 45fac17

Please sign in to comment.