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

Add reset reapply to batch reset command #700

Merged
merged 4 commits into from
Nov 19, 2024
Merged

Conversation

jamipouchi
Copy link
Contributor

What was changed

Previously reset reapply options were ignored for batch reset, and only used for single workflow reset command.
This pr also adds reset reapply options to batch reset command.

Why?

I have found myself needing to batch-reset workflows without reapplying signals, but unable to do so with the temporal cli. It is possible via sdk code and via tctl, which makes it look as someone forgot to add it.

Checklist

  1. Closes

  2. How was this tested:

I have tested this with my usecase and worked great.
I have not added any tests. Probably some batch-reset tests are needed, but no logic has been added ( I have reused the method that was used for single reset, so there's not much change it's wrong )

  1. Any docs updates needed?

@CLAassistant
Copy link

CLAassistant commented Oct 24, 2024

CLA assistant check
All committers have signed the CLA.

@josh-berry
Copy link
Collaborator

Hi, thanks for sending this over! Sorry we haven't gotten to it quite yet, the team's been rather busy, but one of us will try to look at it soon. Just wanted to make sure you knew we've seen this and it hasn't gotten lost. :)

Copy link
Contributor

@dandavison dandavison left a comment

Choose a reason for hiding this comment

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

Nice, thanks a lot @jamipouchi! I made a couple of minor comments but, do you have time to add the test coverage for this?

}
reapplyExcludes, reapplyType, err := getResetReapplyAndExcludeTypes(c.ReapplyExclude.Values, c.ReapplyType.Value)
if err != nil {
return fmt.Errorf("getting reset reapply and exclude types failed: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the prefix here ("getting reset reapply and...") isn't quite right for a user-facing error message, since it's making reference to an operation that's essentially something CLI internals are doing. I'm thinking just returning err will give the desired error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, agree.
Did it cuz it was similar to the error above getting reset event... error. I have also changed that one.

temporalcli/commands.workflow_reset.go Outdated Show resolved Hide resolved
@jamipouchi
Copy link
Contributor Author

Nice, thanks a lot @jamipouchi! I made a couple of minor comments but, do you have time to add the test coverage for this?

I am going on vacation tomorrow until next wednesday, and then I'll pick up work.
Happy if anyone can do it for me in the meantime, else I can prob. do it in a couple of weeks.

@jamipouchi
Copy link
Contributor Author

Nice, thanks a lot @jamipouchi! I made a couple of minor comments but, do you have time to add the test coverage for this?

I am going on vacation tomorrow until next wednesday, and then I'll pick up work. Happy if anyone can do it for me in the meantime, else I can prob. do it in a couple of weeks.

Hi @dandavison, just added the tests for the batch reset using reapply exclude. Also added first/last workflow task, and one making sure that only wfs matching the query were reset.

Copy link
Contributor

@dandavison dandavison left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this work @jamipouchi, including the careful tests adding coverage that was missing before. My manual testing didn't find any problems.

@dandavison dandavison merged commit b8cd1e7 into temporalio:main Nov 19, 2024
7 checks passed
@dandavison dandavison mentioned this pull request Nov 21, 2024
dandavison added a commit that referenced this pull request Nov 21, 2024
Fix a flaky test from #700

Prior to this commit, failures of

go test -v -count 1 -run '^TestSharedServerSuite/TestWorkflow_ResetBatch_ExcludeSignal$'

were fairly frequent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants