Я делюсь фрагментом кода, в котором хочу продемонстрировать свой вариант использования, циклом, в котором я перебираю группы задач
Код: Выделить всё
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()Код: Выделить всё
idxThe
Код: Выделить всё
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.futuresDo you have any suggestions or experience/insights to share?
Источник: https://stackoverflow.com/questions/781 ... iterations