from time import sleep

def inc(x):
    sleep(1)
return x + 1
your_input_data = list(range(1000))
from queue import Queue
q = Queue()
for i in your_input_data:
    q.put(i)
from dask.distributed import Executor
e = Executor('127.0.0.1:8786')
futures = e.map(inc, q, maxsize=20)
results = e.gather(futures)
L = []
while not q.empty() or not futures.empty() or not results.empty():
    L.append(results.get())
how to throttle a large number of task with out using all workers