Skip to content

Commit

Permalink
Better error when not running on worker
Browse files Browse the repository at this point in the history
Whenver I forget to switch to #5520, the errors are confusing.
  • Loading branch information
gjoseph92 committed Nov 19, 2021
1 parent f79985a commit 2afc22c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion distributed/shuffle/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,20 @@
def get_shuffle_extension() -> ShuffleWorkerExtension:
from distributed import get_worker

return get_worker().extensions["shuffle"]
try:
worker = get_worker()
except ValueError as e:
raise RuntimeError(
"`shuffle='p2p'` requires Dask's distributed scheduler. This task is not running on a Worker; "
"please confirm that you've created a distributed Client and are submitting this computation through it."
) from e
extension: ShuffleWorkerExtension | None = worker.extensions.get("shuffle")
if not extension:
raise RuntimeError(
f"The worker {worker.address} does not have a ShuffleExtension. "
"Is pandas installed on the worker?"
)
return extension


def shuffle_transfer(
Expand Down

0 comments on commit 2afc22c

Please sign in to comment.