- on a schedule
- when triggered by events
- programmatically, on demand
Prerequisites
In order to run a deployment, you need to have:- created a deployment
- started a process (
serve
or a worker) listening for scheduled runs of that deployment
Run a deployment from the CLI
The simplest way to trigger a deployment run is using the Prefect CLI:CLI options
Add parameters and customize the run, including setting a custom flow run name using the new —flow-run-name option:Run a deployment from Python
Use therun_deployment
function for programmatic control:
By default, deployments triggered via
run_deployment
from within another flow will be treated as a subflow of the parent flow in the UI. To disable this, set as_subflow=False
.Async usage
In an async context, you can use therun_deployment
function as a coroutine:
Further reading
- Learn about deployment schedules
- Explore deployment triggers and automations
- Understand work pools and workers