Skip to content
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

Use ContinueAsNewSuggested in scheduler workflow #4990

Merged
merged 2 commits into from
Oct 24, 2023
Merged

Conversation

dnr
Copy link
Member

@dnr dnr commented Oct 17, 2023

What changed?
Scheduler workflow uses server-sent suggestion for when to continue-as-new instead of fixed iteration count.

Note this is not enabled in this PR yet.

Why?
Automatically handle history size/event count too large conditions (or any future conditions added by the server), which we might get if we do more work than expected per iteration.

How did you test it?
new unit tests, also replaced for loop with previous version to verify actual iteration count didn't change

Potential risks
The default history size suggestion is at 4MB, which we could hit after just a few large payload responses, and then we'd do continue-as-new more often than we might like.

@dnr dnr requested a review from a team as a code owner October 17, 2023 18:03
suggestContinueAsNew = suggestContinueAsNew || iters <= 0
iters--
} else {
suggestContinueAsNew = suggestContinueAsNew || info.GetContinueAsNewSuggested()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to use getVersion here since this may eagerly decide to continue as new

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow uses a MutableSideEffect of tweakablePolicies to get the same effect as the versioning api, but in bulk. IterationsBeforeContinueAsNew has always been > 0, we'll change it to 0 to activate this code path (in a separate PR to allow this one to go in a patch release to enable downgrade)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I was missing that context. Thanks. LGTM.

@dnr dnr merged commit 276d610 into temporalio:main Oct 24, 2023
10 checks passed
@dnr dnr deleted the sched68 branch October 24, 2023 22:11
dnr added a commit to dnr/temporal that referenced this pull request Oct 25, 2023
rodrigozhou pushed a commit that referenced this pull request Oct 30, 2023
**What changed?**
Scheduler workflow uses server-sent suggestion for when to
continue-as-new instead of fixed iteration count.

Note this is not enabled in this PR yet.

**Why?**
Automatically handle history size/event count too large conditions (or
any future conditions added by the server), which we might get if we do
more work than expected per iteration.

**How did you test it?**
new unit tests, also replaced for loop with previous version to verify
actual iteration count didn't change

**Potential risks**
The default history size suggestion is at 4MB, which we could hit after
just a few large payload responses, and then we'd do continue-as-new
more often than we might like.
rodrigozhou pushed a commit that referenced this pull request Oct 31, 2023
**What changed?**
Scheduler workflow uses server-sent suggestion for when to
continue-as-new instead of fixed iteration count.

Note this is not enabled in this PR yet.

**Why?**
Automatically handle history size/event count too large conditions (or
any future conditions added by the server), which we might get if we do
more work than expected per iteration.

**How did you test it?**
new unit tests, also replaced for loop with previous version to verify
actual iteration count didn't change

**Potential risks**
The default history size suggestion is at 4MB, which we could hit after
just a few large payload responses, and then we'd do continue-as-new
more often than we might like.
dnr added a commit that referenced this pull request Nov 7, 2023
**What changed?**
Tweak schedule settings to activate changes in #4990 and #5034

**Why?**
Make it work

**How did you test it?**
existing tests
rodrigozhou pushed a commit that referenced this pull request Nov 30, 2023
**What changed?**
Tweak schedule settings to activate changes in #4990 and #5034

**Why?**
Make it work

**How did you test it?**
existing tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants