Skip to content

Commit 01b0463

Browse files
committed
Add logging and teardown prints to full-fledged-streaming example
1 parent f1902f7 commit 01b0463

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

examples/full_fledged_streaming_service.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ async def stream_data(seed):
1212

1313
# this is the third actor; the aggregator
1414
async def aggregate(seed):
15-
"""Ensure that the two streams we receive match but only stream
15+
'''
16+
Ensure that the two streams we receive match but only stream
1617
a single set of values to the parent.
17-
"""
18+
19+
'''
1820
async with tractor.open_nursery() as nursery:
1921
portals = []
2022
for i in range(1, 3):
@@ -69,7 +71,8 @@ async def push_to_chan(portal, send_chan):
6971
async def main():
7072
# a nursery which spawns "actors"
7173
async with tractor.open_nursery(
72-
arbiter_addr=('127.0.0.1', 1616)
74+
arbiter_addr=('127.0.0.1', 1616),
75+
loglevel='cancel',
7376
) as nursery:
7477

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

98+
print("ROOT STREAM CONSUMER COMPLETE")
99+
100+
print("ROOT CANCELLING AGGREGATOR CHILD")
95101
await portal.cancel_actor()
96102

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

0 commit comments

Comments
 (0)