Hi there, I'm currently getting acquainted with P...
# ask-community
t
Hi there, I'm currently getting acquainted with Prefect to determine whether I could use it in a new project. Basically, I have to create a REST API used to trigger heavy computation workflows. For the flows themselves, I think the DaskTaskRunner will do the trick. The thing is when a request for a new job is made, obviously the API will not return the result but rather a job ID that the user can use later to fetch the result once the job is finished. I was wondering what is the best way to achieve this. My understanding is that unlike tasks, flows cannot be submitted/delayed and return a future, or I missed something? Maybe the idea would be then to serve the flows and then call the Prefect REST API to trigger a flow run? Thanks and keep up the good work! Théo
n
hi @Theom - this idea makes sense to me! > serve the flows and then call the Prefect REST API to trigger a flow run whether you use
run_deployment
from your endpoint or use the REST API to do the same thing directly, you can: • trigger the run • get the ID back to the user • decide how to expose access to the result alternatively, one thing you might be interested in is background tasks, which are websocket based and easier to scale horizontally if needed (but roughly the same idea) https://github.com/zzstoatzz/prefect-pack/tree/main/examples/do_celery_stuff
upvote 2
t
Many thanks @Nate for your response. I'll go with served flows and API calls!