Emon Datta
12/02/2024, 5:32 PMtest-deployment
. how can i trigger a run of test-deployment
programmatically from my separate service?Marvin
12/02/2024, 5:32 PMrun_deployment
function to create a flow run from a deployment in a Python script. Here's a basic example:
python
from prefect.deployments import run_deployment
def main():
response = run_deployment(name="flow-name/deployment-name")
print(response)
if __name__ == "__main__":
main()
Be sure to replace "flow-name/deployment-name"
with the actual flow and deployment name you intend to run. Also, ensure that the PREFECT_API_URL
is set if you're using an agent to run the deployment remotely. For more information, you can refer to the Prefect 2.x documentation.
### Prefect 3.x
In Prefect 3.x, deployments provide an API and UI to manually trigger and manage flow runs. You can define triggers in your prefect.yaml
file, which can trigger deployment runs based on specific events. More details on this can be found here and here.
Feel free to look into these documentation links for more detailed instructions and examples based on your exact needs. And remember, if you find yourself overwhelmed by the sheer vastness of the orchestration universe, you’re in good company. Even Marvin the paranoid android would probably find compiling QByteArray triggers mildly diverting.