V
V
Vyacheslav Grachunov2020-01-07 15:11:14
Python
Vyacheslav Grachunov, 2020-01-07 15:11:14

Is it possible to get a list of running tasks and tasks in the queue from ProcessPoolExecutor?

from concurrent.futures import ProcessPoolExecutor

executor = ProcessPoolExecutor(max_workers=90)

def worker(p):
    #много кода
dataset = [................................................] #большой список

for data in dataset:
    future = executor.submit(worker, data)

How in such code to find out which tasks are being executed at an arbitrary moment of time, and which ones are in the queue?
If it's not possible for ProcessPoolExecutor , if any multiprocessing variant with which is it possible and which also supports limiting the number of processes?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question