Would there be a recommended way for a client to b...
# ask-community
r
Would there be a recommended way for a client to block waiting for a flow to complete? I am sending the task request with a combo of graphql and the client functions (like prefect flow run) but I would like the endpoint to block for a while for shorter tasks. Just looking for ideas. (I have puslar integrated so I might simply subscribe and have a task in the end of the flow publish, unblocking the client).
k
Hi @Rob Fowler! I’ll double check but there is no way to block waiting for a flow to complete. Maybe submitting the smaller tasks as a separate flow to the agent will make it run immediately because that will start a new process.
r
That will not really work, it does take some time to start a container. That said, I could fire the flow and then wait sleeping for a short time for short flows. As my flows can be minutes I think I'll have to go with adding a final task to each of my flows. It would be an interesting add to have a flow finaliser task for all flows.
👍 1
Circling back. I created a new pulsar task 'PublishTail'. I put this onto the end of all my tasks. It takes the last result as an argument and publishes the item or last record if it is a list. Then my external systems simply wait on a pulsar topic 'Results'. The same thing could be done with a redis blocking pop.
👍 1
k
Nice you figured that out @Rob Fowler!