Skip to content

Deprecate worker callbacks #5779

Open
Open
@jrbourbeau

Description

@jrbourbeau

We have an older Client.register_worker_callbacks system for allowing users to specify a setup function to be run when workers are started. However this system was replaced with the more generic worker plugin system in #2453. Today, Client.register_worker_callbacks is actually implemented using our worker plugin system:

def register_worker_callbacks(self, setup=None):
"""
Registers a setup callback function for all current and future workers.
This registers a new setup function for workers in this cluster. The
function will run immediately on all currently connected workers. It
will also be run upon connection by any workers that are added in the
future. Multiple setup functions can be registered - these will be
called in the order they were added.
If the function takes an input argument named ``dask_worker`` then
that variable will be populated with the worker itself.
Parameters
----------
setup : callable(dask_worker: Worker) -> None
Function to register and run on all workers
"""
return self.register_worker_plugin(_WorkerSetupPlugin(setup))

Deprecating worker callbacks was part of the original plan when the worker plugin system was introduced, I think we just never got around to it. Opening an issue to track deprecating Client.register_worker_callbacks in favor of Client.register_worker_plugin

Metadata

Metadata

Assignees

No one assigned

    Labels

    deprecationSomething is being removed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions