Here is a simple code to test the apply() method, but it ended up with an EOFError exception:
import asyncio
from aiomultiprocess import Pool
async def worker():
pass
async def main():
async with Pool() as pool:
tasks = [pool.apply(worker) for i in range(5)]
await asyncio.gather(*tasks)
if __name__ == "__main__":
asyncio.run(main())
Here is the output:
File "/home/babak/web/test/TEST.py", line 14, in <module>
asyncio.run(main())
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/babak/web/test/TEST.py", line 9, in main
async with Pool() as pool:
^^^^^^
File "/home/babak/env_311/lib/python3.11/site-packages/aiomultiprocess/pool.py", line 186, in __init__
self.init()
File "/home/babak/env_311/lib/python3.11/site-packages/aiomultiprocess/pool.py", line 214, in init
self.processes[self.create_worker(qid)] = qid
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/babak/env_311/lib/python3.11/site-packages/aiomultiprocess/pool.py", line 251, in create_worker
process = PoolWorker(
^^^^^^^^^^^
File "/home/babak/env_311/lib/python3.11/site-packages/aiomultiprocess/pool.py", line 59, in __init__
super().__init__(
File "/home/babak/env_311/lib/python3.11/site-packages/aiomultiprocess/core.py", line 109, in __init__
namespace=get_manager().Namespace(),
^^^^^^^^^^^^^
File "/home/babak/env_311/lib/python3.11/site-packages/aiomultiprocess/core.py", line 29, in get_manager
_manager = context.Manager()
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/multiprocessing/context.py", line 57, in Manager
m.start()
File "/usr/lib/python3.11/multiprocessing/managers.py", line 567, in start
self._address = reader.recv()
^^^^^^^^^^^^^
File "/usr/lib/python3.11/multiprocessing/connection.py", line 250, in recv
buf = self._recv_bytes()
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/multiprocessing/connection.py", line 430, in _recv_bytes
buf = self._recv(4)
^^^^^^^^^^^^^
File "/usr/lib/python3.11/multiprocessing/connection.py", line 399, in _recv
raise EOFError
What am I doing wrong?
OS: Ubuntu 20.0.4 running on a cheap VPS with 1 core CPU and about 1.3 GB of free RAM
Here is a simple code to test the apply() method, but it ended up with an
EOFError
exception:Here is the output:
What am I doing wrong?