asyncio version of the standard multiprocessing module
Project description
aiomultiprocess
Multiprocessing, but AsyncIO.
Install
aiomultiprocess requires Python 3.6 or newer. You can install it from PyPI:
$ pip3 install aiomultiprocess
Usage
Most of aiomultiprocess mimics the standard multiprocessing module whenever possible, while accounting for places that benefit from async functionality.
Executing a coroutine on a child process is as simple as:
from aiomultiprocess import Process
async def foo(...):
...
p = Process(target=foo, args=..., kwargs=...)
p.start()
await p.join()
If you want to get results back from that coroutine, then use Worker instead:
from aiomultiprocess import Worker
async def foo(...):
...
p = Worker(target=foo, args=..., kwargs=...)
p.start()
await p.join()
print(p.result)
If you want a managed pool of worker processes, then use Pool:
from aiomultiprocess import Pool
async def foo(value):
return value * 2
async with Pool() as pool:
result = await pool.map(foo, range(10))
License
aiomultiprocess is copyright John Reese, and licensed under
the MIT license. I am providing code in this repository to you under an open
source license. This is my personal repository; the license you receive to
my code is from me and not from my employer. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file aiomultiprocess-0.2.0.tar.gz.
File metadata
- Download URL: aiomultiprocess-0.2.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0accab24fcc4d50452dee8f7bf53657db5ccd5ed489c09bbad0e74a7572250c2
|
|
| MD5 |
f79e1a9bd7a164b89065b267b0ecc340
|
|
| BLAKE2b-256 |
f108348755b5254c7e5236510aaa56d81b800182eb63a99224b25fc8479fd244
|