https://prefect.io logo
a

Anat Tal Gagnon

08/30/2022, 1:39 PM
Hi again, I'm trying to start flow run from REST API with Postman - but it's stuck in status PENDING. The agent started but it's not picking it up.... any ideas ??? http://localhost:4200/api/deployments/aa64fe41-a2f2-43c3-80f8-38e9d5c1ad26/create_flow_run
1
n

Nate

08/30/2022, 1:41 PM
Hey @Anat Tal Gagnon, Have you created a deployment? If so, you could check to make sure that your agent is listening on the same workqueue as your deployment will send flow runs to for example, if you ran
prefect agent start -q myqueue
then in your
prefect deployment build
command you'd want to pass
-q myqueue
as well
a

Anat Tal Gagnon

08/30/2022, 1:49 PM
Yes both on same -q
Maybe because something is missing in the api request?
The queue is missing from the flow run itself
n

Nate

08/30/2022, 1:55 PM
hmm, could you try using the python client? just to rule out any weirdness with using Postman as your client here here's an example of how you could
create_flow_run_from_deployment
by
deployment_id
Copy code
from prefect.client import get_client
from prefect.utilities.asyncutils import sync_compatible

@sync_compatible
async def trigger_flow_run(deployment_id: str, params: dict) -> FlowRun:
    async with get_client() as client:
        return await client.create_flow_run_from_deployment(
            deployment_id=deployment_id, parameters=params
        )
a

Anat Tal Gagnon

08/30/2022, 1:57 PM
Yes this works
Rest doesn’t
n

Nate

08/30/2022, 2:01 PM
hmm, what REST endpoint were you hitting / what did your request body look like?
a

Anat Tal Gagnon

08/30/2022, 2:04 PM
Very simple body only parameters
Is there something needed to specify the queue? I thought it should get from the deployment id
n

Nate

08/30/2022, 2:11 PM
the flow run should be put into the queue attached to the deployment that it came from I will try and replicate this when I can, do you mind sharing the actual content of your request body? and the endpoint URL you used
a

Anat Tal Gagnon

08/30/2022, 2:12 PM
Sure will do in a bit I’m not on the computer
👍 1
Hi @Nate, I'm able to reproduce with the most basic test flow run
The "Work Queue" don't make it from the response to the Flow Run
so it stays pending forever
it's not Postman issue, same with post python request
n

Nate

08/30/2022, 6:31 PM
can you share the command you used to
build
your deployment?
a

Anat Tal Gagnon

08/30/2022, 6:32 PM
prefect deployment build ./test.py:hello_world -n hello -q test
it works with python api
just the REST api is messed up
I reproduced it again on a new flow in 5 minutes
same thing
n

Nate

08/30/2022, 6:35 PM
ok, thank you for raising this - would you be able to open an issue here? that way we can address it as soon as possible and you can track its progress
a

Anat Tal Gagnon

08/30/2022, 6:40 PM
n

Nate

08/30/2022, 7:35 PM
thank you!
a

Arnas

10/24/2022, 10:32 PM
Hello! I just ran into this too (work queue not being assigned when creating flow run via REST API). Has anyone found a solution for this? I really hope I am doing something wrong here!
Apologies, should have done a better job searching in the channel. If anyone else accidentally reads this, the following example worked: https://discourse.prefect.io/t/how-to-trigger-a-flow-run-from-a-deployment-via-api-call[…]python-requests-library-or-from-a-terminal-using-curl/1396