Abhishek Singh
05/10/2024, 2:49 PMMarvin
05/10/2024, 2:49 PM.deploy
. These deployments can be managed independently of one another, allowing you to deploy the same flow with different configurations in the same codebase, or to deploy different flows from different files.
Here's an excerpt from the Prefect documentation that could help explain this:
You can create multiple deployments from one or more Python files that useFor more details, you can read the Prefect Deploy guide, which describes how to work with multiple deployments and provides an example of how to deploy multiple flows from different files. Here's a brief example from the guide:. These deployments can be managed independently of one another, allowing you to deploy the same flow with different configurations in the same codebase. To create multiple work pool-based deployments at once you can use the.deploy
function, which is analogous to thedeploy
function.serve
python
from prefect import deploy, flow
@flow(log_prints=True)
def buy():
print("Buying securities.")
@flow(log_prints=True)
def sell():
print("Selling securities.")
if __name__ == "__main__":
deploy(
buy.to_deployment(name="buy-deploy"),
sell.to_deployment(name="sell-deploy"),
work_pool_name="my-dev-work-pool",
image="my-registry/my-image:latest",
push=False,
)
This shows two flows, buy
and sell
, from presumably different files, being deployed with different configurations.