Tejas Shah
08/14/2024, 7:19 AMflow.serve
and flow.deploy
methods?Marvin
08/14/2024, 7:20 AMpython
get_repo_info.serve(
name="my-first-deployment",
cron="* * * * *",
tags=["testing", "tutorial"],
description="Given a GitHub repository, logs repository statistics for that repo.",
version="tutorial/deployments",
)
- More details here
2. flow.deploy:
- Used to create and register deployment objects with the Prefect API.
- It creates a deployment definition and can include various configuration options like storage, infrastructure, and schedules.
- Example usage:
python
slow_deploy = slow_flow.to_deployment(name="sleeper", interval=45)
fast_deploy = fast_flow.to_deployment(name="fast")
serve(slow_deploy, fast_deploy)
- More details here
Both methods are related to deploying flows, but flow.serve keeps the script running to manage scheduling, while flow.deploy registers the flow deployment with Prefect's API for more managed execution.