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

Revamped implementations of remote print() and warn(), fixing #7095 #7129

Merged
merged 7 commits into from
Oct 18, 2022

Conversation

maxbane
Copy link
Contributor

@maxbane maxbane commented Oct 7, 2022

This PR rewrites the remote print() and warn() functions to be more correct and better documented, as discussed in #7095, and extending the initial work by @fjetter in #5217. Some notes about the implementation:

  • print() relies on msgpack to distinguish correctly between string-valued and None-valued arguments. I've special-cased the file kwarg to disallow using this function to write to arbitrary file-like objects (because it wouldn't be clear how that should work in the possibly remote client thread), while still allowing a distinction between standard out and standard error.
  • warn() handles its own serialization of the message and category arguments into bytes because, if we want it to be truly drop-in, these might be Warning instance objects or classes, which msgpack won't serialize out of the box. See the test function for the various use cases. I feel like the only way this breaks down is if the user does something really bizarre like emit a custom Warning subclass that stores a ton of data in itself.
  • warn() ignores the stacklevel and source arguments in the remote client, because the former would be meaningless in the client's thread and the latter would entail serializing an arbitrary object, which I'd rather avoid.

I've also stuck these functions into the API docs. Assuming this is merged, a good follow-up PR would be to introduce them in the "Debug" page of the main dask docs.

@GPUtester
Copy link
Collaborator

Can one of the admins verify this patch?

Admins can comment ok to test to allow this one PR to run or add to allowlist to allow all future PRs from the same author to run.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 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 32m 26s ⏱️ - 8m 50s
  3 148 tests +  2    3 062 ✔️ +  1    85 💤 ±0  1 +1 
23 288 runs  +16  22 372 ✔️ +18  915 💤  - 3  1 +1 

For more details on these failures, see this check.

Results for commit 96a8df8. ± Comparison against base commit 07e2259.

♻️ This comment has been updated with latest results.

@maxbane
Copy link
Contributor Author

maxbane commented Oct 15, 2022

(All tests pass; the linting errors seem to be a pre-existing problem, not from my code.)

Copy link
Member

@fjetter fjetter left a comment

Choose a reason for hiding this comment

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

Apologies for the slow reply. This looks like truly solid work, thanks for looking into it @maxbane! And welcome as a first-time contributor, of course!

The linting issue is a bit strange but I suspect this to be caused by #7131

@fjetter fjetter merged commit 334af11 into dask:main Oct 18, 2022
gjoseph92 pushed a commit to gjoseph92/distributed that referenced this pull request Oct 31, 2022
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.

3 participants