Tomer Cagan
03/13/2022, 12:21 PMTomer Cagan
03/13/2022, 12:23 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 pathTomer Cagan
03/13/2022, 12:23 PMdistributed.deploy.local.LocalCluster
...
└── 141958 | INFO | The Dask dashboard is available at http://127.0.0.1:8787/status
└── 141959 | 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
└── 141959 | ERROR | Unexpected error occured in FlowRunner: ValueError('No global client found and no address provided')
Flow run failed!Tomer Cagan
03/13/2022, 12:24 PMDaskExecutor
constructorAnna Geller
executor = DaskExecutor(address="<tcp://127.0.0.1:8786>")
Kevin Kho
Anna Geller
client_kwargs=dict(set_as_default=True)
to the Dask executor seems to fix that error you seeTomer Cagan
03/14/2022, 7:55 AMTomer Cagan
03/14/2022, 7:56 AMKevin Kho