Sam Werbalowsky
10/29/2021, 2:37 PMSam Werbalowsky
10/29/2021, 2:42 PMKevin Kho
Kevin Kho
Kevin Kho
gateway = Gateway()
cluster = gateway.new_cluster()
executor = DaskExecutor(
    address=cluster.scheduler_address,
    client_kwargs={"security": cluster.security}
)def create_cluster():
    gateway = Gateway()
    cluster = gateway.new_cluster()
executor = DaskExecutor(create_cluster)Kevin Kho
GatewayClusterAnna Geller
Sam Werbalowsky
10/29/2021, 2:51 PMThis can be either a string specifying the import path to the cluster class (e.g. "dask_cloudprovider.aws.FargateCluster"), the cluster class itself, or a function for creating a custom clusterSam Werbalowsky
10/29/2021, 2:51 PMKevin Kho
flow.executor = DaskExecutor(
    cluster_class=GatewayCluster(),
    cluster_kwargs={"n_workers": 4, "image": "my-prefect-image"},
)Kevin Kho
Anna Geller
import prefect
from dask_cloudprovider.aws import FargateCluster # or ECSClusterpre
def fargate_cluster(n_workers=4):
    """Start a fargate cluster using the same image as the flow run"""
    return FargateCluster(n_workers=n_workers, image=prefect.context.image)
flow.executor = DaskExecutor(
    cluster_class=fargate_cluster,
    cluster_kwargs={"n_workers": 4}
)Sam Werbalowsky
10/29/2021, 2:53 PMdask_gateway.GatewayClusterKevin Kho
Sam Werbalowsky
10/29/2021, 6:18 PMdask_gateway.GatewayClusterKevin Kho
