Replies: 1 comment
-
The solution described in that comment is a standard approach to managing asynchronous workloads which need to be persistent, rather than ephemeral. Let's say that my asynchronous workflow is some sort of long running simulation- the user submits inputs, and ultimately wants to be able to get the outputs of that long running simulation. The users don't have access to the actual hatchet dashboard/database since this is a commercial application and this is hidden infrastructure. First, consider the situation without a database.
However, what happens if, during step 4, the user's computer restarts? Or their browser crashes? Unless they wrote down that run id, or persistently stored it somehow on their own, they would never be able to re-locate that workflow run and recover its data (besides contacting me, the application maintainer, describing their inputs to me, and hoping I am supportive enough to go through the list of all runs and find ones that have identical inputs). The comment in the code then is referencing the common requirement to persist an association between the workflow run id, and some other entity that might want to relocate that workflow run at some arbitrary point in the future. For instance, suppose there is a user account/auth system backed by a database; this database might include a table which has two columns - one for user id, and one for workflow run ids. Maybe the users also submit a name (possibly compound-unique on user id and workflow name) for each simulation so it's easy for them to identify it in the future. This table is used so that you can store and look up all the workflow runs associated with a particular user even if they exit the application/browser/logout, restart their computer, etc etc. The sequence might then look something like this.
Obviously there are a million different ways to go with how you implement all of this according to what your needs are, but that should make the basic idea clear - if you don't persist your workflow run id, the IDs become ephemeral (in the sense that you could only really recover a specific workflow in the future by going through your hatchet workflow runs iteratively checking them one by one). Hopefully that clarifies what those comments were alluding to! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If you don't mind, can you write pseudo code for my understanding.
I saw this text in one of the examples, I'm curious about it.
https://github.com/hatchet-dev/hatchet-python-quickstart/blob/main/fast-api-react/backend/src/api/main.py
Beta Was this translation helpful? Give feedback.
All reactions