[Solved] Multi-tasking with Multiprocessing or Threading or Asyncio, depending on the Scenario


So off the top of my head you can look at 2 things.

1) Asyncio (be careful this example uses threading and is not thread safe specifically the function asyncio.gather)

import asyncio
for work in [1,2,3,4,5]:
    tasks.append(method_to_be_called(work))

results = await asyncio.gather(*tasks)

2) Asyncio + multiprocessing
https://github.com/jreese/aiomultiprocess

1

solved Multi-tasking with Multiprocessing or Threading or Asyncio, depending on the Scenario