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 command for workflow update #200

Merged

Conversation

samanbarghi
Copy link
Contributor

What was changed

Added 'workflow update' command to update workflows.

Why?

There is a new feature to update workflows synchronously: temporalio/temporal#3822

This change adds a command to the client to call that API.

Checklist

  1. How was this tested:
    Tested locally.

  2. Any docs updates needed?

The "workflow" section of CLI doc should be updated: https://docs.temporal.io/cli/workflow

@CLAassistant
Copy link

CLAassistant commented Apr 18, 2023

CLA assistant check
All committers have signed the CLA.

Comment on lines +61 to +62
FlagUpdateHandlerName = "Update handler Name"
FlagUpdateHandlerInput = "Args for the Update handler. Formatted in JSON."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

gofmt reformatted the whole file; these are the new additions.

Comment on lines 388 to 419
{
Name: "update",
Usage: common.UpdateWorkflowDefinition,
UsageText: common.WorkflowUpdateUsageText,
Flags: append(common.FlagsForExecution,
&cli.StringFlag{
Name: common.FlagUpdateWaitPolicy,
Usage: "Wait policy determines how long the client should wait for a return value from the server:" + strings.Join(mapKeysToArray(updateWaitPolicyMap), ", "),
Category: common.CategoryMain,
Required: true,
},
&cli.StringFlag{
Name: common.FlagName,
Usage: common.FlagUpdateHandlerName,
Required: true,
Category: common.CategoryMain,
},
&cli.StringFlag{
Name: common.FlagInput,
Aliases: common.FlagInputAlias,
Usage: common.FlagUpdateHandlerInput,
Category: common.CategoryMain,
},
&cli.StringFlag{
Name: common.FlagUpdateFirstExecutionRunID,
Usage: "Do not run update if workflow exectuion (--run-id or if not set, latest workflow execution) is not part of the same execution chain as this id.",
Category: common.CategoryMain,
},
),
Action: func(c *cli.Context) error {
return UpdateWorkflow(c)
},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

gofmt reformatted the file, here is the new addition.

@feedmeapples feedmeapples self-requested a review April 18, 2023 22:09
@samanbarghi samanbarghi force-pushed the features/add-update-workflow-command branch from a4af667 to f68dcdf Compare April 19, 2023 19:38
tests/workflow_test.go Outdated Show resolved Hide resolved
workflow/workflow.go Outdated Show resolved Hide resolved
workflow/workflow.go Outdated Show resolved Hide resolved
workflow/workflow.go Outdated Show resolved Hide resolved
workflow/workflow_commands.go Outdated Show resolved Hide resolved
workflow/workflow_commands.go Outdated Show resolved Hide resolved
workflow/workflow_commands.go Outdated Show resolved Hide resolved
common/defs-cmds.go Show resolved Hide resolved
tests/e2e_test.go Show resolved Hide resolved
tests/workflow_test.go Show resolved Hide resolved
tests/workflow_test.go Outdated Show resolved Hide resolved
workflow/workflow.go Show resolved Hide resolved
workflow/workflow_commands.go Outdated Show resolved Hide resolved
workflow/workflow_commands.go Outdated Show resolved Hide resolved
workflow/workflow_commands.go Outdated Show resolved Hide resolved
workflow/workflow_commands.go Outdated Show resolved Hide resolved
workflow/workflow_commands.go Outdated Show resolved Hide resolved
@samanbarghi samanbarghi force-pushed the features/add-update-workflow-command branch from c5f5ba6 to 60f35e8 Compare April 25, 2023 23:53
Copy link
Contributor

@MichaelSnowden MichaelSnowden left a comment

Choose a reason for hiding this comment

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

LGTM pending comments

@samanbarghi samanbarghi merged commit a01fea2 into temporalio:main Apr 27, 2023
Comment on lines +42 to +43
//TODO: remove this flag when update workflow is enabled in the server by default
"--dynamic-config-value", "frontend.enableUpdateWorkflowExecution=true",
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this should be enabled here. Let it rely on default value.

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.

7 participants