https://prefect.io logo
Title
t

Tomer Cagan

03/13/2022, 12:21 PM
Hello, Trying to get a performance report based on the information executors documentation. I am getting an error - see in thread
The code - slight changes from the examples in docs*
# flow_report.py
from prefect.executors import DaskExecutor
from prefect import Flow, task

# define a simple task and flow
@Aui Task
def hello():
  return "hi"

with Flow('performance_report') as flow:
  x = hello()

# specify where the executor should write the performance report
flow.executor = DaskExecutor(performance_report_path="/Users/tomercagan/dev/prefect-play/performance_report.html")
* changes - remove
import os
in the top, and update the path
prefect run -p flow_report.py Retrieving local flow... Done Running flow locally... └── 14:19:57 | INFO | Beginning Flow run for 'performance_report' └── 14:19:57 | INFO | Creating a new Dask cluster with
distributed.deploy.local.LocalCluster
... └── 14:19:58 | INFO | The Dask dashboard is available at http://127.0.0.1:8787/status └── 14:19:59 | ERROR | Unexpected error: ValueError('No global client found and no address provided') Traceback (most recent call last): File "/Users/tomercagan/dev/prefect-play/venv/lib/python3.9/site-packages/prefect/engine/runner.py", line 48, in inner new_state = method(self, state, *args, **kwargs) File "/Users/tomercagan/dev/prefect-play/venv/lib/python3.9/site-packages/prefect/engine/flow_runner.py", line 442, in get_flow_run_state with self.check_for_cancellation(), executor.start(): File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 119, in enter return next(self.gen) File "/Users/tomercagan/dev/prefect-play/venv/lib/python3.9/site-packages/prefect/executors/dask.py", line 253, in start with performance_report_context: File "/Users/tomercagan/dev/prefect-play/venv/lib/python3.9/site-packages/distributed/client.py", line 5418, in enter get_client().sync(self.aenter) File "/Users/tomercagan/dev/prefect-play/venv/lib/python3.9/site-packages/distributed/worker.py", line 4296, in get_client raise ValueError("No global client found and no address provided") ValueError: No global client found and no address provided └── 14:19:59 | ERROR | Unexpected error occured in FlowRunner: ValueError('No global client found and no address provided') Flow run failed!
From what I see, it is not able to retrieve the client while running setting up the performance report. This does not happens when not specifying the path to the report in the
DaskExecutor
constructor
a

Anna Geller

03/13/2022, 1:32 PM
maybe you can specify the address like this?
executor = DaskExecutor(address="<tcp://127.0.0.1:8786>")
k

Kevin Kho

03/13/2022, 3:37 PM
See this for a fix.
a

Anna Geller

03/13/2022, 4:50 PM
@Tomer Cagan copy from above: passing
client_kwargs=dict(set_as_default=True)
to the Dask executor seems to fix that error you see
t

Tomer Cagan

03/14/2022, 7:55 AM
This works - thanks! Note that I had to manually install bokeh (dependency of the dashboard, not sure why this is required...
what does this do?
k

Kevin Kho

03/14/2022, 1:49 PM
The issue explains in detail, but this won’t be needed in the future since we already had an upstream change in dask that was merged to fix this
🙌 1