Skip to content

Commit

Permalink
Raise helpful error when using the wrong plugin base classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson committed Oct 15, 2024
1 parent 9bec841 commit 1d2044d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions distributed/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5101,6 +5101,14 @@ def _register_plugin(
):
if isinstance(plugin, type):
raise TypeError("Please provide an instance of a plugin, not a type.")
if any(
"dask.distributed.diagnostics.plugin" in str(c)
for c in plugin.__class__.__bases__
):
raise TypeError(
"Importing plugin base classes from `from dask.distributed.diagnostics.plugin` "
"is not supported. Please import directly from `distributed.diagnostics.plugin` instead."
)
raise TypeError(
"Registering duck-typed plugins is not allowed. Please inherit from "
"NannyPlugin, WorkerPlugin, or SchedulerPlugin to create a plugin."
Expand Down

0 comments on commit 1d2044d

Please sign in to comment.