-
Notifications
You must be signed in to change notification settings - Fork 40
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
add internal demo saga #6281
add internal demo saga #6281
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really cool! What do you think about copying the PR's description you wrote with examples into a doc? It'd be useful for people just getting started
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good to me!
I left a few comments on potential future additions to the omdb nexus sagas
commands you've added, but I think it would probably be better to save those for a later branch, unless you really want to add them now?
Also, I left a comment on the assert!
, but I will freely admit that it's probably not actually a big deal to have it there.
Good idea. I went ahead and added this as docs/demo-saga.adoc. I'm not sure it's that discoverable but in the future I hope we can organize the docs into a more explicit "Omicron developer guide" book. |
This PR adds to Nexus "demo" saga, which is a one-node saga that sits and waits for a request (on the internal API) to tell it to finish. The point of this saga is to help with testing saga recovery and #6215. It's easiest to see with an omdb example.
First, I started
omicron-dev run-all
:Then I started a second copy of Nexus using the instructions, just so I could more easily control its execution:
As part of this I also added
omdb
subcommands to list the sagas that a Nexus instance knows about. (This is not to be confused with a general command for listing all sagas. It only lists the sagas that this instance knows about in-memory, not anything that ran in a past life or in another Nexus.) Start by listing them:Now we can create a demo saga:
We can see it in the list of sagas now. It's running:
and it will stay running indefinitely until we run
demo-complete
. Let's do that:and then list sagas again:
It works across recovery, too. You can go through the same loop again, but this time kill Nexus and start it again:
After restarting Nexus, we don't see the earlier saga because it was finished when Nexus started. But we see the one we created later because it was recovered:
Side note: we can see it was recovered:
Now we can complete that saga:
I considered trying to only include this in development or something like that, but I don't think there's any harm to having it present all the time and it could conceivably even be useful in production (during support).