Document per-func actors for clarity
							parent
							
								
									049513235d
								
							
						
					
					
						commit
						232de86143
					
				|  | @ -267,12 +267,14 @@ actor and print the results to your screen: | ||||||
|     import tractor |     import tractor | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     # this is the first 2 actors, streamer_1 and streamer_2 | ||||||
|     async def stream_data(seed): |     async def stream_data(seed): | ||||||
|         for i in range(seed): |         for i in range(seed): | ||||||
|             yield i |             yield i | ||||||
|             await trio.sleep(0)  # trigger scheduler |             await trio.sleep(0)  # trigger scheduler | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     # this is the third actor; the aggregator | ||||||
|     async def aggregate(seed): |     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. |         a single set of values to the parent. | ||||||
|  | @ -325,6 +327,7 @@ actor and print the results to your screen: | ||||||
|         print("AGGREGATOR COMPLETE!") |         print("AGGREGATOR COMPLETE!") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |     # this is the main actor and *arbiter* | ||||||
|     async def main(): |     async def main(): | ||||||
|         # a nursery which spawns "actors" |         # a nursery which spawns "actors" | ||||||
|         async with tractor.open_nursery() as nursery: |         async with tractor.open_nursery() as nursery: | ||||||
|  |  | ||||||
|  | @ -352,12 +352,14 @@ def test_cancel_single_subactor(): | ||||||
|     tractor.run(main, arbiter_addr=_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): | async def stream_data(seed): | ||||||
|     for i in range(seed): |     for i in range(seed): | ||||||
|         yield i |         yield i | ||||||
|         await trio.sleep(0)  # trigger scheduler |         await trio.sleep(0)  # trigger scheduler | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | # this is the third actor; the aggregator | ||||||
| async def aggregate(seed): | 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. |     a single set of values to the parent. | ||||||
|  | @ -409,6 +411,7 @@ async def aggregate(seed): | ||||||
|     print("AGGREGATOR COMPLETE!") |     print("AGGREGATOR COMPLETE!") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | # this is the main actor and *arbiter* | ||||||
| async def a_quadruple_example(): | async def a_quadruple_example(): | ||||||
|     # a nursery which spawns "actors" |     # a nursery which spawns "actors" | ||||||
|     async with tractor.open_nursery() as nursery: |     async with tractor.open_nursery() as nursery: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue