Haleemur Ali

    Haleemur Ali

    4 months ago
    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!
    Michael Adkins

    Michael Adkins

    4 months ago
    Hey! You can use the prefect CLI for both of these easily e.g.
    prefect run --name "your-flow-name"
    Here are some examples from the
    prefect run --help
    menu
    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
    Haleemur Ali

    Haleemur Ali

    4 months ago
    Thanks Michael