-
Notifications
You must be signed in to change notification settings - Fork 23
run a step inside a go routine #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@af-md thanks for the PR! The approach has the right fundamentals, i.e., I think we can make this simpler by simply having a package level With respect to what chans = make([]chan int, 3)
for := range 10 {
resChan1, err := dbos.Go(ctx, StepFnClosure)
// handle err
}
// Read from each channel here The res channel can hold types similar to the workflow outcome chan:
|
…implify result handling
…uce stepWithSleep function
@maxdml does this feature have any conflict with what @apoliakov said about pre generating stepIDs: https://discord.com/channels/1156433345631232100/1166779411920597002/1413954852618244267 It makes sense to run steps inside Go routines - as they tend to be better performant compared to standard execution - however the users should be advised to write their code to wait for a step to complete (committed into DB) and then move onto the next step? probably that's what you were thinking of anyway... |
Ah... what I said was a comment on how Python works. Here we may have an opportunity to make it act differently. But Max or Peter will need to opine on that |
…step ID generation
@maxdml @apoliakov there is a small misunderstanding here. The problem we are solving with this PR is the non deterministic generation of stepIDs, resulting from the execution of steps in goroutines. What this PR will do is to serialize the generation of step IDs from within the workflow. That way, step IDs will be generated deterministically, before the |
closes #90
Summary
Adds support for running steps inside goroutines with deterministic step ID generation.
This is by no means the final solution, it's a PR to get feedback.
Problem
Currently, running steps inside goroutines causes non-deterministic step ID generation due to race conditions:
Solution
Pre-generate step IDs before launching goroutines:
Open Questions
ToDos