https://prefect.io logo
#prefect-community
Title
# prefect-community
h

Haleemur Ali

05/13/2022, 2:50 AM
hi folks, I'm curious to know how I would go about triggering a flow via prefect cloud from my local machine. I have the following use-cases: 1. run a prefect job in our CICD process: Here I'm envisioning having some sort of API Key present in our CICD, and perhaps making a post request to prefect.io to trigger the flow I'm interested in 2. trigger failed jobs manually, but rather than logging into prefect cloud and hitting the rocket ship icon, I'd prefer to not leave my terminal. maybe there is a client for prefect-cloud already, so we wouldn't have to post requests using curl, but I'm comfortable curl-ing my way through this. Thanks in advance folks!
z

Zanie

05/13/2022, 3:58 AM
Hey! You can use the prefect CLI for both of these easily e.g.
Copy code
prefect run --name "your-flow-name"
Here are some examples from the
prefect run --help
menu
Copy code
Run registered flow with the backend by flow name and watch execution

     $ prefect run -n "hello-world" --watch

   Run registered flow with the backend with custom labels

     $ prefect run -n "hello-world" --label example --label hello

   Run registered flow with the backend by flow id and exit after creation

     $ prefect run -i "9a1cd70c-37d7-4cd4-ab91-d41c2700300d"

   Run registered flow and pipe flow run id to another program

     $ prefect run -n "hello-world" --quiet | post_run.sh

   Run registered flow and execute locally without an agent

     $ prefect run -n "hello-world" --execute
h

Haleemur Ali

05/13/2022, 4:33 AM
Thanks Michael
7 Views