<@ULVA73B9P> How do I trigger a deployment run via...
# ask-marvin
r
@Marvin How do I trigger a deployment run via the python api?
k
from within a flow, or outside a flow?
I am not marvin but I can try
r
Ha. Thanks Kevin! This is within a flow.
m
To trigger a deployment run via the Python API in Prefect, you can use the
run_deployment
function provided by Prefect. Below is a small snippet demonstrating its use:
Copy code
python
from prefect.deployments import run_deployment

def main():
    run_deployment(name="my_flow_name/my_deployment_name")
For more information on running a deployed flow from within Python code, refer to the Prefect Deployments documentation. Additionally, if you are looking to interact with automations or to use webhooks for triggering deployments, you can review the guides on Automations and Concepts of Automations. The code example linked is not directly related to triggering deployment runs, but if you want to explore task submission and concurrency in Prefect, you can find the code at this GitHub link.
👍 1
k
dang marv
I was about to paste the same thing
r
Kevin, thank you much sir. Followed you on LinkedIn.
🐐 1
k
wow thanks
🎉 1
r
@jason baker