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

Replace register_worker_callbacks with worker plugins #2453

Merged
merged 10 commits into from May 22, 2019

Conversation

mrocklin
Copy link
Member

@mrocklin mrocklin commented Jan 8, 2019

These provide space for a bit more complexity, including teardown and optional idempotence. This is still a work in progress. Some things I'd like to do:

  • deprecate register_worker_callbacks
  • support simple setup functions in register_worker_plugins
  • improve error handling in broadcast

cc @rainwoodman and @guillaumeeb . Possible replacement for #2391

distributed/client.py Outdated Show resolved Hide resolved
@rainwoodman
Copy link
Contributor

I like this better than #2391.

Copy link
Member

@guillaumeeb guillaumeeb left a comment

Choose a reason for hiding this comment

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

I agree with @rainwoodman, this design looks better!

distributed/client.py Outdated Show resolved Hide resolved
distributed/client.py Outdated Show resolved Hide resolved
distributed/client.py Outdated Show resolved Hide resolved
distributed/client.py Outdated Show resolved Hide resolved
distributed/worker.py Show resolved Hide resolved
@mrocklin
Copy link
Member Author

@jcrist should you find yourself with a moment this could also use your review

@mrocklin
Copy link
Member Author

Docs added in dask/dask#4833

@mrocklin
Copy link
Member Author

I plan to merge this this afternoon if there are no further comments

def register_worker_plugin(self, plugin=None, name=None):
"""
Registers a lifecycle worker plugin for all current and future workers.

Copy link
Member

Choose a reason for hiding this comment

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

General question: do you have thoughts on using ..versionadded:: <version> directives? Don't need to do it here necessarily, but I ask since this is being referenced from the dask documentation, which may be on a different release cycle.

Copy link
Member Author

Choose a reason for hiding this comment

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

No strong thoughts. I've never used them much, either as an author or reader.

My plan was just to merge the doc PR after this gets released.

Happy with whatever though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I see that you've since merged the doc PR :) Shouldn't be a big deal either way

Copy link
Member

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Small question on a test name. Since Github / travis have been having issues with web hooks today, you may just want to merge.



@gen_cluster(client=True, worker_kwargs={"plugins": [MyPlugin(5)]})
def test_idempotence_with_name(c, s, a, b):
Copy link
Member

Choose a reason for hiding this comment

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

Are the names of these two tests flipped (this one doesn't use plugin names, the other does?)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that we're good here. The MyPlugin class has a name attribute, which is what causes the idempotence here.

In the test below, we change the name intentionally.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, understood.

@TomAugspurger TomAugspurger merged commit 6134c75 into dask:master May 22, 2019
@mrocklin mrocklin deleted the worker-plugin branch May 22, 2019 21:24
@mrocklin
Copy link
Member Author

Woot. Thanks for merging @TomAugspurger ! I think that some version of this PR has existed for years now :)

calebho pushed a commit to calebho/distributed that referenced this pull request May 29, 2019
* Add worker plugins

* add docstring

* Replace legacy worker_callbacks with worker_plugins

* add and test name keyword

* fix missing import

* black

* respond to feedback

* Handle errors again

* Expand docstring
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.

None yet

4 participants