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

Don't heartbeat while Worker is closing #6543

Merged
merged 3 commits into from
Jun 9, 2022

Conversation

gjoseph92
Copy link
Collaborator

Previously, the heartbeat could run while close was running. The scheduler would probably say the worker was unknown, and the worker would then try to close itself. This wouldn't actually be a big deal, since close is idempotent.

Mostly this just cleans up a very contrived test to instead test a more realistic scenario. It also adds a freeze_batched_send which may be useful in other places.

After writing all this, I don't actually care much about the reordering of the PeriodicCallback.stop() in Worker.close(); if anyone objects to it, happy to revert.

  • Tests added / passed
  • Passes pre-commit run --all-files

gjoseph92 added 3 commits June 8, 2022 18:47
We're going to fix the race condition we were exploiting here, but a simpler one still exists.
@gjoseph92 gjoseph92 self-assigned this Jun 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2022

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

       15 files  ±0         15 suites  ±0   6h 20m 51s ⏱️ + 3m 25s
  2 854 tests +1    2 771 ✔️ ±0    81 💤 ±0  2 +1 
21 144 runs  +7  20 197 ✔️ +6  945 💤 ±0  2 +1 

For more details on these failures, see this check.

Results for commit 20d3198. ± Comparison against base commit 9e4e3ab.

orig_comm = bcomm.comm

write_event = asyncio.Event()
write_queue: asyncio.Queue = asyncio.Queue()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is it actually necessary to explicitly annotate this? That feels absurd.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, mypy actually raised an error explicitly telling me to do this. I agree it's absurd.

Comment on lines +1779 to +1780
# closes the worker. Heartbeats aren't sent over batched comms, so
# `freeze_batched_send` doesn't affect them.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I'm inclined to change this eventually and reuse the stream for heartbeats

@fjetter fjetter merged commit 879fb89 into dask:main Jun 9, 2022
@gjoseph92 gjoseph92 deleted the worker-no-heartbeat-while-closing branch June 9, 2022 14:51
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