jpuris
02/28/2023, 4:12 PMcurl --request POST \
--url "<https://api.prefect.cloud/api/accounts/$PREFECT_ACCOUNT_ID/workspaces/$PREFECT_WORKSPACE_ID/flow_runs>" \
--header "Authorization: Bearer $PREFECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"flow_id": "0c6a7af0-e534-44dd-a88a-151db5c289fc",
"deployment_id": "03e816d7-38f9-4c1f-b036-efc37a1084c1"
}'
The flow just sits there, queue-less in PENDING state. How can I tell it to place the flow run in a queue for one of my agent's to pick it up and run it?
Alternatively, since the deployment is associated with a queue, why is Prefect not putting this flow there implicitly?
However, the method described by Anna G. in a blog post "How to trigger a flow run from a deployment via API call using Python requests library or from a terminal using curl?" works!
❯ curl --request POST \
--url "<https://api.prefect.cloud/api/accounts/$PREFECT_ACCOUNT_ID/workspaces/$PREFECT_WORKSPACE_ID/deployments/$PREFECT_DEPLOYMENT_ID/create_flow_run>" \
--header "Authorization: Bearer $PREFECT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"name": "your_flow_run", "state": {"type": "SCHEDULED"}}'
Is the API docs wrong, and to create a flow, one must POST to /create_flow_run
and not /flow_runs
? 😕
P.S. Originally posted in #CL09KU1K7, but now moved to #CM28LL405Sahil Rangwala
02/28/2023, 6:53 PMjpuris
02/28/2023, 6:54 PM# The work queue that will handle this deployment's runs
work_queue_name: dev_redacted
work_pool_name: null
/create_flow_run
does it correctly and puts the flow run in the queue described by the deployment.
In both cases, I'm referencing the same deployment IDSahil Rangwala
02/28/2023, 7:01 PM