Я делюсь фрагментом кода, в котором хочу продемонстрировать свой вариант использования, циклом, в котором я перебираю группы задач
Код: Выделить всё
for idx, task in enumerate(tasks):
try:
manager.open_connection(idx)
for jdx, subtask in enumerate(task):
subtask.io_bound_read_from_sql()
subtask.io_bound_read_from_fs()
subtask.cpu_bound_compute()
subtask.io_bound_write_to_sql()
finally:
manager.close_connection(idx)
Both methods
Код: Выделить всё
io_bound_read_from_sql()
Код: Выделить всё
io_bound_write_to_sql()
Код: Выделить всё
idx
The
Код: Выделить всё
open_connection(idx)
Код: Выделить всё
close_connection(idx)
Also,
Код: Выделить всё
io_bound_read_from_fs()
The sequence of functions called on the
Код: Выделить всё
subtask
Код: Выделить всё
subtask
Код: Выделить всё
jdx
Код: Выделить всё
1
Код: Выделить всё
io_bound_write_to_sql()
Код: Выделить всё
subtask
Код: Выделить всё
jdx
Код: Выделить всё
io_bound_read_from_sql()
My question is how to design this proof of concepts. I wish not to use
Код: Выделить всё
multiprocessing
Код: Выделить всё
multithreading
Код: Выделить всё
asyncio
Код: Выделить всё
asyncio
Код: Выделить всё
multithreading
Код: Выделить всё
concurrent.futures
Do you have any suggestions or experience/insights to share?
Источник: https://stackoverflow.com/questions/781 ... iterations