-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Description
Description
I can't execute the example code in the Process section. Both the apply() method as the map(math.sqrt) method.
I've managed to get the math.sqrt working but not like indicated in the example. I moved the math.sqrt call to an asyncio aware section because if I don't, the interpreter complains about exactly this.
TypeError: An asyncio.Future, a coroutine or an awaitable is required
Edit: To be complete : I'm getting following error when using the apply() method:
RuntimeError: await wasn't used with future
_
My adaptation for the sqrt example:
import asyncio
import math
from aiomultiprocess import Pool
async def sqrt_task(data):
return math.sqrt(data)
async def main():
async with Pool() as pool:
data = [1, 4, 9, 16, 25]
results = await pool.map(sqrt_task, data)
print(results)
if __name__ == '__main__':
asyncio.run(main())
Details
- OS: Ubuntu 22.04.1 LTS
- Python version: 3.7.10
- aiomultiprocess version: 0.9.0
- Can you repro on master?
- Can you repro in a clean virtualenv?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels