<@ULVA73B9P> what is the equivalent of `prefect de...
# ask-marvin
a
@Marvin what is the equivalent of
prefect deployment run '<flow-name>/<deployment-name>
in python
m
Ah, you want the Python equivalent of firing up a specific deployment in Prefect. Let's get your Prefect version to give you the most accurate help. Could you please share if you are using Prefect 2.x or 3.x?
a
@Marvin 2.x
m
You can run a deployment in Prefect 2.x using Python by utilizing the
run_deployment
API method. Here's a concise example:
Copy code
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!