Brain isn’t quite working today. I have a flow Parameter called
cluster
which determines whether a cluster is used which is accessed from a callback to
DaskCluster
. However, it’s not actually used in the flow which is causing flow run failures locally because it’s an ‘unexpected parameter’. I am 90% sure I’ve seen a way before where I can say to Prefect to relax and that it’s fine (technical terminology), but can’t remember exactly how
✅ 1
a
Anna Geller
05/19/2022, 9:52 AM
I think what you mean is adding a Parameter explicitly to the flow object using
.add_task()
?
Copy code
from prefect import Flow
from prefect.executors import DaskExecutor
def dynamic_executor():
from distributed import LocalCluster
# could be instead some other class e.g. from dask_cloudprovider.aws import FargateCluster
return LocalCluster(n_workers=prefect.context.parameters["n_workers"])
with Flow("example", executor=DaskExecutor(cluster_class=dynamic_executor)) as flow:
flow.add_task(Parameter("n_workers", default=5))
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.