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
Optionally capture more frames in computations #7656
Conversation
renaming seems unnecessary
@gjoseph92 is there already a pattern is dask-land for modifying client-side config? I'm not currently aware of a way to override the default but also not override if user sets this to non-default value? Would we say that if you're using Coiled, then |
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 26 files + 15 26 suites +15 13h 28m 11s ⏱️ + 9h 20m 12s For more details on these failures, see this check. Results for commit 77893e2. ± Comparison against base commit 37ce1a0. ♻️ This comment has been updated with latest results. |
theoretically, you can set config values in import or when running certain functions using
There is no way to register default fallbacks for certain configuration values (yet) |
@@ -5539,7 +5551,8 @@ async def __aenter__(self): | |||
async def __aexit__(self, exc_type, exc_value, traceback, code=None): | |||
client = get_client() | |||
if code is None: | |||
code = client._get_computation_code(self._stacklevel + 1) | |||
frames = client._get_computation_code(self._stacklevel + 1, nframes=1) | |||
code = frames[0] if frames else "<Code not available>" |
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.
Magic string here doesn't seem ideal, what about using None
when we can't get code?
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 inserted into the performance report; _get_computation_code
would have returned "<Code not available>"
before this PR, so I wanted to just keep the same behavior.
For Coiled I think it's important that we're able to set the default to something non-zero, since we want to collect code by default, while also letting user override. Is there a good way to do that? According to the config doc, dask defaults take precedence over project defaults. |
Yeah, I think the problem is that we can't distinguish "0 because it's the default" from "0 because the user is explicitly setting it to override Coiled setting it to something non-zero". We could make the default None in config, and convert None to 0 in code? (Not as ideal but easier to override.) |
I dislike this, but another option would be for the coiled package to set |
An issue was raised that reports the slowness of this code collection in #7740 which would motivate disabling this by default. There is a not-welll-hardly-at-all documented way for third parties to register defaults, IIUC coiled could set it's default here on import time ( and call config.refresh). If this does not work we should take care of this issue in another PR. @gjoseph92 can you rebase/merge main please? |
@fjetter merged main. Agreed that it seems we should merge this to turn the behavior off by default, then look into how Coiled will set the config in a separate PR. It looks like distributed is using distributed/distributed/config.py Lines 21 to 24 in 77893e2
That sounds pretty much like what we're looking for for Coiled. It just automates what you suggested of adding to |
That's interesting. There's always something new to discover... |
Adds a
distributed.diagnostics.computations.nframes
parameter, controlling how many frames of client code are captured inComputation
s.Sets the default value to 0, so by default, no code is captured. I can easily change this to 1 if we'd prefer. But 0 seemed like a reasonable default, since:
submit
in a loop.Also changes
Computation.code
from holding strings to tuples of strings.pre-commit run --all-files
cc @ntabris