Alireza
09/10/2024, 11:13 AMprefect deployment run '<flow-name>/<deployment-name>
in pythonMarvin
09/10/2024, 11:13 AMAlireza
09/10/2024, 11:14 AMMarvin
09/10/2024, 11:14 AMrun_deployment
API method. Here's a concise example:
python
from prefect.deployments import run_deployment
# Replace with your flow and deployment names
flow_name = "<flow_name>"
deployment_name = "<deployment_name>"
# Initiate the deployment run
flow_run = run_deployment(f"{flow_name}/{deployment_name}")
# Optionally, wait for the flow run to complete and get the result
flow_run_state = flow_run.wait()
print(flow_run_state)
This code snippet runs a specified deployment and waits for its completion.
Sources:
- Prefect Deployments Concept: Prefect Deployments
- GitHub Issues and Docs examples: GitHub Issue 15276
Feel free to ask if you need further assistance!