Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion distributed/diagnostics/tests/test_worker_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def setup(self, worker):
assert list(responses.values()) == [{"status": "OK"}]

async with Worker(s.address, loop=s.loop):
responses = await c.register_worker_plugin(FooWorkerPlugin(), name="foo")
with pytest.warns(FutureWarning, match="worker plugin will be overwritten"):
responses = await c.register_worker_plugin(FooWorkerPlugin(), name="foo")
assert list(responses.values()) == [{"status": "repeat"}] * 2


Expand Down
7 changes: 7 additions & 0 deletions distributed/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2722,6 +2722,13 @@ async def plugin_add(self, comm=None, plugin=None, name=None):
assert name

if name in self.plugins:
warnings.warn(
"Attempting to add a worker plugin with the same name as an already registered "
f"plugin ({name}). Currently this results in no change and the previously registered "
"plugin is not overwritten. This behavior is deprecated and in a future release "
f"the previously registered {name} worker plugin will be overwritten.",
category=FutureWarning,
)
return {"status": "repeat"}
else:
self.plugins[name] = plugin
Expand Down