Anton L.
07/12/2024, 2:09 PMMarvin
07/12/2024, 2:09 PMFlow.deploy
function in Prefect, you'll need to use the pull
section within your deployment configuration. Here are some useful details extracted from the Prefect documentation:
1. Pull Steps Configuration:
The pull
section is crucial for preparing your flows for deployment runs. It includes instructions like setting the working directory, cloning a Git repository, or pulling from a cloud storage location.
2. Example Configuration:
Below is an example of a deployment configuration that uses S3 for storing the flow code:
pull:
- prefect_aws.deployments.steps.pull_from_s3:
requires: prefect-aws>=0.3.0
bucket: my-bucket
folder: "{{ push-code.folder }}"
credentials: null
3. Using Blocks and Variable References:
You can use block and variable references within your pull steps for secure and dynamic configuration.
Additionally, here's a simple example of using Flow.deploy
with S3:
from prefect import flow
from prefect_aws.s3 import S3Bucket
if __name__ == "__main__":
flow.from_source(
source=S3Bucket.load("my-code-storage"), entrypoint="my_file.py:my_flow"
).deploy(name="test-s3", work_pool_name="my_pool")
For more detailed information, you can refer to the Prefect deployment guide:
Prefect Deployment Guide
And an example flow can be found here:
Example Flow