Skip to content

Conversation

@douglasdavis
Copy link
Member

@douglasdavis douglasdavis commented May 11, 2021

@martindurant

@douglasdavis
Copy link
Member Author

douglasdavis commented May 11, 2021

Starting a draft PR and looking for a bit of early feedback:

  1. After a quick chat with @martindurant he mentioned that the async def f(...) function that is passed to Client.run_on_scheduler may be better off outside of the Client class. Looking for some additional feedback there
  2. 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?

@martindurant
Copy link
Member

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.

@douglasdavis
Copy link
Member Author

Thanks for the tip! -- pinging @jrbourbeau

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.

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?

@douglasdavis douglasdavis force-pushed the scheduler-plugins branch 2 times, most recently from 0eb428f to cdd756b Compare June 1, 2021 18:54
Copy link
Member

@jrbourbeau jrbourbeau left a 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.

@jrbourbeau
Copy link
Member

Also, there is a small linting issue in CI. You can install pre-commit hooks to make sure things like flake8, black, etc. are automatically run when you make a git commit locally

@douglasdavis douglasdavis marked this pull request as ready for review June 15, 2021 19:43
@douglasdavis
Copy link
Member Author

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.

Copy link
Member

@jrbourbeau jrbourbeau left a 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.

@douglasdavis
Copy link
Member Author

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

Copy link
Member

@jrbourbeau jrbourbeau left a 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

@douglasdavis
Copy link
Member Author

Thanks @jrbourbeau! Let me know if there are any final dangling issues

Copy link
Member

@jrbourbeau jrbourbeau left a 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

@douglasdavis
Copy link
Member Author

Ah, thanks for catching-- adjustments made

Copy link
Member

@jrbourbeau jrbourbeau left a 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

@jrbourbeau jrbourbeau merged commit 1bcd8a9 into dask:main Jun 23, 2021
@douglasdavis douglasdavis deleted the scheduler-plugins branch June 24, 2021 01:59
mrocklin pushed a commit that referenced this pull request Aug 22, 2021
Following up on some discussion in #4808, this converts scheduler plugin storage from a list to a dictionary (key: name, value: plugin instance)
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.

Add Client.register_scheduler_plugin

4 participants