-
-
Notifications
You must be signed in to change notification settings - Fork 717
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
Add docs for test_resumed_cancelled_handle_compute #6905
Open
fjetter
wants to merge
2
commits into
dask:main
Choose a base branch
from
fjetter:docs_for_test_resumed_cancelled_handle_compute
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+72
−3
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -47,6 +47,7 @@ | |||||||
SerializedTask, | ||||||||
StateMachineEvent, | ||||||||
TaskErredMsg, | ||||||||
TaskFinishedMsg, | ||||||||
TaskState, | ||||||||
TransitionCounterMaxExceeded, | ||||||||
UnpauseEvent, | ||||||||
|
@@ -1293,3 +1294,35 @@ def test_gather_dep_failure(ws): | |||||||
] | ||||||||
assert ws.tasks["x"].state == "error" | ||||||||
assert ws.tasks["y"].state == "waiting" # Not ready | ||||||||
|
||||||||
|
||||||||
@pytest.mark.parametrize("fail", [True, False]) | ||||||||
def test_executing_cancelled_fetch_executing(ws, fail): | ||||||||
"""See also test_cancelled_state.py::test_resumed_cancelled_handle_compute for full example""" | ||||||||
|
||||||||
ws2 = "127.0.0.1:2" | ||||||||
instructions = ws.handle_stimulus( | ||||||||
ComputeTaskEvent.dummy("x", stimulus_id="s1"), | ||||||||
FreeKeysEvent(keys=["x"], stimulus_id="s2"), | ||||||||
ComputeTaskEvent.dummy("y", who_has={"x": [ws2]}, stimulus_id="s3"), | ||||||||
FreeKeysEvent(keys=["y"], stimulus_id="s4"), | ||||||||
ComputeTaskEvent.dummy("x", stimulus_id="s5"), | ||||||||
) | ||||||||
|
||||||||
assert len(instructions) == 1 | ||||||||
assert instructions[0] == Execute(key="x", stimulus_id="s1") | ||||||||
Comment on lines
+1312
to
+1313
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.
Suggested change
|
||||||||
if fail: | ||||||||
instructions = ws.handle_stimulus( | ||||||||
ExecuteFailureEvent.dummy(key="x", stimulus_id="s6") | ||||||||
) | ||||||||
assert len(instructions) == 1 | ||||||||
assert isinstance(instructions[0], TaskErredMsg) | ||||||||
Comment on lines
+1318
to
+1319
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.
Suggested change
|
||||||||
assert ws.tasks["x"].state == "error" | ||||||||
|
||||||||
else: | ||||||||
instructions = ws.handle_stimulus( | ||||||||
ExecuteSuccessEvent.dummy(key="x", stimulus_id="s6") | ||||||||
) | ||||||||
assert len(instructions) == 1 | ||||||||
assert isinstance(instructions[0], TaskFinishedMsg) | ||||||||
Comment on lines
+1326
to
+1327
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.
Suggested change
|
||||||||
assert ws.tasks["x"].state == "memory" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
TODO: This actually fails when using the
ws_with_running_task
fixture because we're not releasing a resource properly. Will try again after #6699There 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.
Could you move this test to test_cancelled_state.py?
I'd rather have tests grouped by what they test, not by how they test it.
I already added a
-m workerstate
to pytest to run all WorkerState tests throughout the whole test suite (#6706) for this purpose.