Repository navigation
Don't make False add-keys report to scheduler #2421
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1271,3 +1271,50 @@ def test_startup2(): | |
| # Final exception test | ||
| with pytest.raises(ZeroDivisionError): | ||
| yield c.register_worker_callbacks(setup=lambda: 1 / 0) | ||
|
|
||
|
|
||
| @gen_cluster(client=True) | ||
| def test_worker_keeps_data_gh2420(c, s, a, b): | ||
| # Make a piece of data which is slow to serialize, to trigger the race | ||
| # Put data X on worker A | ||
| # Give task Y to worker B so that it fetches X from A | ||
| # Cancel the task on B | ||
| # Wait until the transfer is done | ||
| # Ensure that the scheduler's who_has for X is accurate | ||
| class SlowSerializeObj(object): | ||
| """An object which is slow to serialize and deserialize.""" | ||
| def __getstate__(self): | ||
| import time | ||
| time.sleep(1) | ||
| return {} | ||
|
|
||
| def __setstate__(self, d): | ||
| import time | ||
| time.sleep(1) | ||
|
|
||
| x = c.submit(SlowSerializeObj, workers=a.address) | ||
| yield wait(x) | ||
| assert not a.executing | ||
| assert x.key in a.data | ||
|
|
||
| def bogus_task(bogus_input): | ||
| import time | ||
| time.sleep(1) | ||
| return 2 | ||
|
|
||
| y = c.submit(bogus_task, x, workers=b.address) | ||
| yield c._cancel(y) | ||
|
|
||
| # The notification to the scheduler happens in a batched send | ||
| # Make sure it has time to arrive | ||
| yield gen.sleep(5) | ||
| try: | ||
| yield wait(y) | ||
| except: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I agree this |
||
| pass | ||
|
|
||
| # for entry in b.log: | ||
| # print("b log: %s" % str(entry)) | ||
|
|
||
| assert (x.key in a.data) == (a.address in s.who_has[x.key]) | ||
| assert (x.key in b.data) == (b.address in s.who_has[x.key]) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can safely drop the underscore here. The public functions will operate asynchronously in an asynchronous context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm slightly concerned that
ymay never start. Should we wait untilbis executing something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think it's important that
ynever starts - we need to causexto be transferred fromatob, but then haveybe cancelled while that transfer is occurring - so thatxis never actually placed in memory onb. This timing is hard to arrange in the test (and I suspect actually now even harder with #2428),