Remove use of tractor.run()
parent
da27d96682
commit
f715a0cae8
|
@ -50,7 +50,14 @@ async def worker_pool(workers=4):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async with tractor.open_nursery() as tn:
|
async with tractor.open_nursery(
|
||||||
|
loglevel='ERROR',
|
||||||
|
|
||||||
|
# uncomment to use ``multiprocessing`` fork server backend
|
||||||
|
# which gives a startup time boost at the expense of nested
|
||||||
|
# processs scalability
|
||||||
|
# start_method='forkserver')
|
||||||
|
) as tn:
|
||||||
|
|
||||||
portals = []
|
portals = []
|
||||||
results = []
|
results = []
|
||||||
|
@ -62,7 +69,7 @@ async def worker_pool(workers=4):
|
||||||
portals.append(
|
portals.append(
|
||||||
await tn.start_actor(
|
await tn.start_actor(
|
||||||
f'worker_{i}',
|
f'worker_{i}',
|
||||||
rpc_module_paths=[__name__],
|
enable_modules=[__name__],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -105,15 +112,9 @@ async def main():
|
||||||
|
|
||||||
print(f'processing took {time.time() - start} seconds')
|
print(f'processing took {time.time() - start} seconds')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
start = time.time()
|
|
||||||
tractor.run(
|
|
||||||
main,
|
|
||||||
loglevel='ERROR',
|
|
||||||
|
|
||||||
# uncomment to use ``multiprocessing`` fork server backend
|
if __name__ == '__main__':
|
||||||
# which gives a startup time boost at the expense of nested
|
|
||||||
# processs scalability
|
start = time.time()
|
||||||
# start_method='forkserver')
|
trio.run(main)
|
||||||
)
|
|
||||||
print(f'script took {time.time() - start} seconds')
|
print(f'script took {time.time() - start} seconds')
|
||||||
|
|
Loading…
Reference in New Issue