-
-
Notifications
You must be signed in to change notification settings - Fork 750
Add support for registering scheduler plugins from Client #4808
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
Conversation
|
Starting a draft PR and looking for a bit of early feedback:
|
|
You will want to ping a couple of specific people for feedback here, or likely no one will notice so long as it is marked draft. |
|
Thanks for the tip! -- pinging @jrbourbeau |
fjetter
left a comment
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.
Worker plugins use a name which is useful for unregistering. As of now the scheduler plugins are stored in a Python list, so right now I can image removal perhaps being a bit tricky without a name. Should we work on supporting named scheduler plugins?
The idempotency logic currently uses types to infer whether a plugin is already there or not. The remove, however, is a bit more simple and only works if you are trying to remove the identical instance so there is room for improvement.
I'd be open for a named plugin system but am a bit afraid of the idempotency problem and am wondering if this is worth it or if it makes everything more difficult to use if we introduce names. What if people try to register the same plugin but using a different name? What if there are different plugin types trying to use the same name?
de47a03 to
0eb428f
Compare
0eb428f to
cdd756b
Compare
jrbourbeau
left a comment
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.
Thanks for the updates @douglasdavis! Apologies for the delayed review, this PR is looking good
Worker plugins use a name which is useful for unregistering. As of now the scheduler plugins are stored in a Python list, so right now I can image removal perhaps being a bit tricky without a name. Should we work on supporting named scheduler plugins?
That's a good point. I think we should work on supporting named scheduler plugins similar to how we already treat worker plugins. Though initially we'll want to have some compatibility code to support the current behavior so there's a smooth transition for any current users of Scheduler.remove_plugin.
|
Also, there is a small linting issue in CI. You can install pre-commit hooks to make sure things like |
5285e08 to
e5b87f7
Compare
|
Thanks for all of the help here @jrbourbeau, I've gone ahead and removed the draft label as I think this is getting pretty close. Also added support for unregistering scheduler plugins, happy to hear thoughts on that. |
a93fed0 to
bfe2bb9
Compare
jrbourbeau
left a comment
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.
Thanks @douglasdavis! If we’re going to have a Client.unregister_scheduler_plugin, then I’d like to see us move towards using named scheduler plugins / storing them in a dictionary on the scheduler instead of a list (similar to how we treat worker plugins today) and removing them by name instead of by instance. I think this will make thing easier to reason about once users are able to register scheduler plugins from the Client process.
Also, depending on how you're feeling, we can not worry about Client.unregister_scheduler_plugin for now. We could just limit the scope of this PR to registering scheduler plugins and take care of unregistering them in a later PR. We can definitely include that functionality here, but I just wanted to give you an exit opportunity in case there are other things you're interested in working on.
|
Hey @jrbourbeau -- thanks for the explanation! After reading, I agree unregistering plugins via reorganization with a dictionary (like worker plugins) is a good idea. Since the registering functionality here is ready to go, I've gone ahead removed the unregistering code in this PR (going in the limited scope direction that you mentioned). I'm happy to take on the dictionary + unregistering feature in a subsequent PR |
jrbourbeau
left a comment
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.
Just left some final comments, but overall this looks good
|
Thanks @jrbourbeau! Let me know if there are any final dangling issues |
jrbourbeau
left a comment
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.
Thanks @douglasdavis! Just one minor comment, otherwise this is good to merge
|
Ah, thanks for catching-- adjustments made |
jrbourbeau
left a comment
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.
Thanks @douglasdavis! This looks great, will merge after CI finishes
Following up on some discussion in #4808, this converts scheduler plugin storage from a list to a dictionary (key: name, value: plugin instance)
Client.register_scheduler_plugin#4745black distributed/flake8 distributed/isort distributed@martindurant