Soham
07/10/2024, 5:05 AMMarvin
07/10/2024, 5:05 AMExecutor
class manages the Dask cluster's lifetime using the standard Dask cluster interface. Here’s an example:
python
from prefect.executors import DaskExecutor
executor = DaskExecutor(
cluster_class="dask_cloudprovider.FargateCluster",
cluster_kwargs={"image": "my-fancy-prefect-image"},
# Additional config here
)
2. Cancellation Support: The DaskExecutor
can be configured to handle state transitions like Cancelling
. This allows Prefect to shut down the cluster if a flow run is canceled.
3. Integration with Kubernetes: Examples show specific configurations for using Dask with Kubernetes. This involves deprecating previous classes in favor of a unified DaskExecutor
approach:
python
from prefect.environments import KubernetesJobEnvironment
environment = KubernetesJobEnvironment(
executor_class=DaskExecutor,
executor_kwargs=dict(
cluster_class="dask_kubernetes.KubeCluster",
cluster_kwargs={"n_workers": 2, "resources": {"memory": "2GB"}}
)
)
More detailed discussions and examples may be found in specific Github issues, such as:
- Decouple Dask and Environments
- Support for cancellation of active flow runs
Let me know if you need more specific examples or details.