-
Notifications
You must be signed in to change notification settings - Fork 411
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
[MRG] Don't scatter data inside dask workers #1061
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5cb45ab
clear python exception state before scattering
pierreglaser 40ef478
don't scatter in nested dask calls
pierreglaser ab1e6b1
apply matthew's suggestion about using hash=False
pierreglaser f8a3158
test that nested scatter calls run successfully
pierreglaser b337e76
remove unused import
pierreglaser db28fe5
Merge branch 'master' into dask-no-nested-scatter
ogrisel c56cdfb
update CHANGES.rst
pierreglaser eeabb67
Update joblib/_dask.py
pierreglaser 04d8188
remove leftover print function calls
pierreglaser File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
secede, | ||
rejoin | ||
) | ||
from distributed import get_worker | ||
from distributed.utils import thread_state | ||
|
||
try: | ||
|
@@ -43,6 +44,14 @@ def is_weakrefable(obj): | |
return False | ||
|
||
|
||
def _in_dask_worker(): | ||
try: | ||
worker = get_worker() | ||
except ValueError: | ||
worker = None | ||
return worker | ||
|
||
|
||
class _WeakKeyDictionary: | ||
"""A variant of weakref.WeakKeyDictionary for unhashable objects. | ||
|
||
|
@@ -252,12 +261,18 @@ async def maybe_to_futures(args): | |
try: | ||
f = call_data_futures[arg] | ||
except KeyError: | ||
if is_weakrefable(arg) and sizeof(arg) > 1e3: | ||
pass | ||
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. Now, we won't get confusing |
||
if f is None: | ||
if (not _in_dask_worker() and is_weakrefable(arg) and | ||
sizeof(arg) > 1e3): | ||
# Automatically scatter large objects to some of | ||
# the workers to avoid duplicated data transfers. | ||
# Rely on automated inter-worker data stealing if | ||
# more workers need to reuse this data | ||
# concurrently. | ||
# Because nested scatter call often end up | ||
# cancelling tasks, (distributed/issues/3703), we | ||
# never scatter inside nested Parallel calls. | ||
[f] = await self.client.scatter( | ||
[arg], | ||
asynchronous=True | ||
|
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.
This is probably a little bit more robust.