From 984d53b7ac3905bfc23a68524f5e5c62fe038120 Mon Sep 17 00:00:00 2001 From: Oliver Mannion <125105+tekumara@users.noreply.github.com> Date: Wed, 8 May 2024 12:48:04 +1000 Subject: [PATCH] feat: demo setting n_workers --- flows/dask_flow.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flows/dask_flow.py b/flows/dask_flow.py index 9d50abe..47a76be 100644 --- a/flows/dask_flow.py +++ b/flows/dask_flow.py @@ -17,7 +17,10 @@ def say_goodbye(name: str) -> None: # TODO: can the task runner be parameterised so we don't duplicate the flow with dask_kubes_flow? # see https://github.com/PrefectHQ/prefect/issues/5560 -@flow(task_runner=DaskTaskRunner()) + + +# creates a LocalCluster https://docs.dask.org/en/stable/deploying-python.html#localcluster +@flow(task_runner=DaskTaskRunner(cluster_kwargs={"n_workers": 2})) def dask(names: list[str]) -> None: for name in names: # tasks must be submitted to run on dask