Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Scheduler.rebalance return value when data is missing #3670

Merged
merged 3 commits into from
Apr 4, 2020

Conversation

jrbourbeau
Copy link
Member

This PR improves error handling in Scheduler.rebalance when keys which are being rebalanced are found to be missing on workers. Currently when we attempt to return the missing data keys here

"keys": sum([r["keys"] for r in result if "keys" in r], []),

we get the following error:

TypeError: can only concatenate list (not "dict") to list

because r["keys"] is a dictionary. We update things here to return a tuple of keys.

Example to trigger missing data in rebalance:
import time
import random
from itertools import count

import dask.array as da
from distributed import Client

with Client() as client:
    counter = count()
    while next(counter) < 10:
        x = da.random.normal(size=100, chunks=1)
        x = x.persist()
        
        time.sleep(random.random() * 0.1)
        x = None
        client.rebalance()

Note: there were also several trailing commas that black wanted to add

@mrocklin
Copy link
Member

mrocklin commented Apr 3, 2020

Thanks @jrbourbeau . Should we add some variant of the example as a test?

@jrbourbeau
Copy link
Member Author

I added a simplified version of the example as a test. It relies on the cluster deleting Futures while rebalancing is taking place, which seems less reliable than I usually like for unit tests. That said, I haven't been able to think of a more direct test and it's been failing consistently on my laptop. If CI passes we should be good to merge this and I'll keep an eye out for if this test ends up failing on PRs

@mrocklin mrocklin merged commit 88d0513 into dask:master Apr 4, 2020
@mrocklin
Copy link
Member

mrocklin commented Apr 4, 2020

Thanks @jrbourbeau

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants