Noah Holm
09/08/2025, 12:12 PMMarvin
09/08/2025, 12:12 PMMarvin
09/08/2025, 12:16 PMprefect.deployments.deploy(...)
and it will create/update all of them in your Prefect Cloud workspace in one call.
Example:
from prefect.deployments import deploy
from prefect.deployments.runner import RunnerDeployment
deploy(
# First flow
RunnerDeployment(
name="etl",
entrypoint="flows/etl.py:etl",
tags=["prod"],
parameters={"days_back": 1},
),
# Second flow
RunnerDeployment(
name="reporting",
entrypoint="flows/reporting.py:reporting",
tags=["prod"],
),
# Defaults applied to all unless overridden on a RunnerDeployment
work_pool_name="kubernetes-pool",
image="<http://ghcr.io/my-org/my-image:latest|ghcr.io/my-org/my-image:latest>",
build=True, # build the image
push=True, # push the image
)
Notes:
- Each RunnerDeployment
can override settings like work_pool_name
, parameters
, tags
, and schedules
.
- The top-level work_pool_name
, image
, build
, and push
apply to all deployments unless overridden.
- Make sure your environment is authenticated to Prefect Cloud (e.g., via prefect cloud login
or environment variables) before running this.
Docs:
- Deploy via Python (multiple deployments)
- Create deployments with the SDK
If you prefer using flows directly, you can also do:
from prefect import flow
flow_a = flow.from_source("<https://github.com/my-org/my-repo>", "flows/a.py:flow_a")
flow_b = flow.from_source("<https://github.com/my-org/my-repo>", "flows/b.py:flow_b")
flow_a.deploy("flow-a", work_pool_name="kubernetes-pool")
flow_b.deploy("flow-b", work_pool_name="kubernetes-pool")
…but the batch helper above is the simplest way to “do them all at once.”