I’m a bit lost with your screenshots, the tasks profile (length of green bars) look very different, so I’m not sure what to answer.
I just tested on a LocalCluster with he following code:
from distributed import Client
import time
import random
client = Client(n_workers=8)
def my_func(x):
time.sleep(random.random() * 2.0)
return x+1
n = 3
w = list(client.cluster.workers)[:n]
futures=[]
for i in range(100):
futures.append(client.submit(my_func,i, pure=False, workers=w, allow_other_workers = False))
results = client.gather(futures)
My method for specifying Workers is different than yours because this wasn’t working. But using this code, the occupancy of the Workers I specified looks good in the dashboard.
Yes I agree the screenshots maybe were confusing. In the two examples, the calculation is the same, and number of workers is the same, so my question is why the cluster computed them differently.
Using w = list(client.cluster.workers)[:n], gives me AttributeError: 'GatewayCluster' object has no attribute 'workers'. So I use client.run(lambda: get_worker().address) since I could not find any other API-way. Do you know of other alternatives?
Great, I retried with pure=False. Not able to point exactly to what else I did different. But it seems the computation looks good now, so I should close this. Thanks again!