не работает.
my_processpool_executor = ProcessPoolExecutor(4)
def process_task_hi(data) -> str:
return "hi"+len(data)
async def put_task_for_exec(msg, data):
loop = asyncio.get_event_loop()
result = await loop.run_in_executor(my_processpool_executor, process_task_hi, data)
await msg.reply(result)
Что за хуйня это
пишет: Traceback (most recent call last): File "/home/zatv/anaconda3/envs/myenvi/lib/python3.7/multiprocessing/queues.py", line 236, in _feed obj = _ForkingPickler.dumps(obj) File "/home/zatv/anaconda3/envs/myenvi/lib/python3.7/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) _pickle.PicklingError: Can't pickle <function process_task_hi at 0x7f56b2084b00>: attribute lookup process_task_hi on main failed """
я пытаюсь запустить процесс в пуле (from concurrent.futures.process import ProcessPoolExecutor).
Зачем?
Обсуждают сегодня