Tomer Cagan
03/13/2022, 12:21 PM# 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 pathdistributed.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!DaskExecutor
constructorAnna Geller
03/13/2022, 1:32 PMexecutor = DaskExecutor(address="<tcp://127.0.0.1:8786>")
Kevin Kho
03/13/2022, 3:37 PMAnna Geller
03/13/2022, 4:50 PMclient_kwargs=dict(set_as_default=True)
to the Dask executor seems to fix that error you seeTomer Cagan
03/14/2022, 7:55 AMKevin Kho
03/14/2022, 1:49 PM