-
Notifications
You must be signed in to change notification settings - Fork 250
Revamp python Continue-as-New documentation #3549
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
[Continue-As-New](/workflow-execution/continue-as-new) lets a Workflow Execution close successfully and create a new Workflow Execution. You can think of it as a checkpoint when your Workflow gets too long or approaches certain scaling limits. | ||
|
||
The new Workflow Execution keeps the same Workflow Id but gets a new Run Id and a fresh Event History. | ||
It also receives your Workflow's usual parameters. |
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.
How about a docs-prose-friendly version of the following?
You pass in the input to the new Workflow Run when you Continue-As-New. In practice what this means is that you will design your Workflow parameters so that you can pass in the "current state" when you Continue-As-New. You may want that parameter to default to
None
so that you don't have to pass it when starting the Workflow normally.
Also I think a code sample showing a workflow definition that has been designed to work with Continue-As-New would be great here.
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.
Good suggestion. I did as you suggested, albeit mostly in the next section.
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.
One more suggestion: here, where you say this
lets a Workflow Execution close successfully and create a new Workflow Execution
I found it helpful to consult https://docs.temporal.io/workflow-execution#workflow-execution-chain where "close" and "Workflow Execution" are defined, and it's documented that indeed continue-as-new is one of the ways to close, and what a "Run ID" is.
So maybe a link from this point to there?
|
||
The new Workflow Execution keeps the same Workflow Id but gets a new Run Id and a fresh Event History. | ||
It also receives your Workflow's usual parameters. | ||
Note that Continue-As-New works as an atomic operation. |
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.
I think this needs to be spelled out for users. You're saying either it closes and starts successfully, or doesn't close at all, right? Impossible to close and not start.
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.
On second thought, I think this is probably answering a question nobody has; I'm guessing they'd implicitly assume it was atomic. Removing it unless there's pushback.
|
||
::: | ||
Check this helper each time you consider using Continue-as-New. |
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.
Check this helper each time you consider using Continue-as-New. | |
Check this helper in your test each time you consider using Continue-as-New. |
9658dc5
to
3361c7e
Compare
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.
One more suggestion but LGTM!
What does this PR do?
is_continue_as_new_suggested
all_handlers_finished
Test Plan
Click all the links
Notes to reviewers