Last active
December 17, 2021 19:48
-
-
Save jcrist/58c8ab358f998129c536e80dc0c19f04 to your computer and use it in GitHub Desktop.
Prefect Examples with RunConfigs and Executors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from prefect import Flow | |
from prefect.storage import S3 | |
from prefect.run_configs import ECSRun | |
from prefect.executors import DaskExecutor | |
with Flow("example") as flow: | |
... | |
flow.storage = S3("my-flows") | |
flow.run_config = ECSRun() # Run job on ECS instead of locally | |
flow.executor = DaskExecutor( | |
cluster_class="dask_cloudprovider.aws.FargateCluster", | |
cluster_kwargs={"image": "prefecthq/prefect", "n_workers": 5} | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from prefect import Flow | |
from prefect.storage import S3 | |
from prefect.run_configs import ECSRun | |
from prefect.executors import LocalDaskExecutor | |
with Flow("example") as flow: | |
... | |
flow.storage = S3("my-flows") | |
flow.run_config = ECSRun(cpu="2 vcpu", memory="4 GB") # increase resource limits | |
flow.executor = LocalDaskExecutor(num_workers=8) # Use a local dask cluster |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from prefect import Flow | |
from prefect.storage import S3 | |
from prefect.run_configs import LocalRun | |
from prefect.executors import DaskExecutor | |
with Flow("example") as flow: | |
... | |
flow.storage = S3("my-flows") | |
flow.run_config = LocalRun() | |
flow.executor = DaskExecutor( | |
cluster_class="dask_cloudprovider.aws.FargateCluster", | |
cluster_kwargs={"image": "prefecthq/prefect", "n_workers": 5} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment