-
-
Notifications
You must be signed in to change notification settings - Fork 757
Workers can fetch remote data when local clients are busy #5206
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
Open
wwoods
wants to merge
1
commit into
dask:main
Choose a base branch
from
wwoods:main-localfix
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.
Open
Changes from all commits
Commits
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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -288,6 +288,12 @@ class Worker(ServerNode): | |
| * **in_flight_workers**: ``{worker: {task}}`` | ||
| The workers from which we are currently gathering data and the | ||
| dependencies we expect from those connections | ||
| * **busy_workers**: ``{worker}`` | ||
| The workers from which we have tried to gather data and received | ||
| a busy response. These will be removed from the list as they are | ||
| needed. | ||
| * **busy_workers_log**: ``{worker}`` | ||
| For testing, log of all workers which ever reported busy. | ||
| * **comm_bytes**: ``int`` | ||
| The total number of bytes in flight | ||
| * **threads**: ``{key: int}`` | ||
|
|
@@ -423,6 +429,8 @@ def __init__( | |
|
|
||
| self.in_flight_tasks = 0 | ||
| self.in_flight_workers = dict() | ||
| self.busy_workers = set() | ||
| self.busy_workers_log = set() | ||
| self.total_out_connections = dask.config.get( | ||
| "distributed.worker.connections.outgoing" | ||
| ) | ||
|
|
@@ -2164,11 +2172,17 @@ def ensure_communicating(self): | |
| in_flight = True | ||
| continue | ||
| host = get_address_host(self.address) | ||
| local = [w for w in workers if get_address_host(w) == host] | ||
| workers_not_busy = [ | ||
| w for w in workers if w not in self.busy_workers | ||
| ] | ||
| local = [w for w in workers_not_busy if get_address_host(w) == host] | ||
| if local: | ||
| worker = random.choice(local) | ||
| else: | ||
| elif not workers_not_busy: | ||
| self.busy_workers.difference_update(workers) | ||
| worker = random.choice(list(workers)) | ||
| else: | ||
| worker = random.choice(list(workers_not_busy)) | ||
| to_gather, total_nbytes = self.select_keys_for_gather( | ||
| worker, to_gather_ts.key | ||
| ) | ||
|
|
@@ -2361,6 +2375,8 @@ async def gather_dep( | |
|
|
||
| if response["status"] == "busy": | ||
| self.log.append(("busy-gather", worker, to_gather_keys)) | ||
| self.busy_workers.add(worker) | ||
| self.busy_workers_log.add(worker) | ||
|
Comment on lines
+2377
to
+2379
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 would prefer you using the |
||
| for key in to_gather_keys: | ||
| ts = self.tasks.get(key) | ||
| if ts and ts.state == "flight": | ||
|
|
||
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.
IIUC
busy_workersbusy_workers, it will always be ignoredbusy_workers.Condition 3.) is very strict since it hides a worker completely until we are lucky enough to hit a task with only busy
who_hasentries.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're following -- I will point out that the 2nd unchecked TODO on this PR is resetting a peer's busy state when fetching a new key belonging to that peer, which will reduce condition 3's strictness. However, I didn't want to go ahead and bother with figuring out how to do that until the larger discussion re: the best approach to dealing with this was resolved.