Skip to content

Commit 9f61163

Browse files
authored
Add pause/unpause commands (#885)
<!--- Note to EXTERNAL Contributors --> <!-- Thanks for opening a PR! If it is a significant code change, please **make sure there is an open issue** for this. We work best with you when we have accepted the idea first before you code. --> <!--- For ALL Contributors 👇 --> ## What was changed Added 2 new commands (experimental) - temporal workflow pause - temporal workflow unpause Did a bunch of unrelated cleanup as well. ## Why? Need these commands to allow pausing and unpausing of workflows via cli ## Checklist <!--- add/delete as needed ---> 1. Closes <!-- add issue number here --> 2. How was this tested: <!--- Please describe how you tested your changes/how we can test them --> 3. Any docs updates needed? <!--- update README if applicable or point out where to update docs.temporal.io -->
1 parent dfd8509 commit 9f61163

File tree

8 files changed

+189
-97
lines changed

8 files changed

+189
-97
lines changed

go.mod

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ require (
1010
github.com/fatih/color v1.18.0
1111
github.com/google/uuid v1.6.0
1212
github.com/mattn/go-isatty v0.0.20
13-
github.com/nexus-rpc/sdk-go v0.3.0
13+
github.com/nexus-rpc/sdk-go v0.5.1
1414
github.com/olekukonko/tablewriter v0.0.5
1515
github.com/spf13/cobra v1.9.1
1616
github.com/spf13/pflag v1.0.6
1717
github.com/stretchr/testify v1.10.0
1818
github.com/temporalio/ui-server/v2 v2.39.0
19-
go.temporal.io/api v1.53.0
19+
go.temporal.io/api v1.58.1-0.20251128181858-703071215042
2020
go.temporal.io/sdk v1.36.0
2121
go.temporal.io/sdk/contrib/envconfig v0.1.0
22-
go.temporal.io/server v1.29.0
22+
go.temporal.io/server v1.29.0-135.0.0.20251210204203-56cbfb9a643c
2323
google.golang.org/grpc v1.72.2
2424
google.golang.org/protobuf v1.36.6
2525
gopkg.in/yaml.v3 v3.0.1
26-
modernc.org/sqlite v1.34.1
26+
modernc.org/sqlite v1.39.1
2727
)
2828

2929
require (
@@ -44,7 +44,7 @@ require (
4444
github.com/Masterminds/semver/v3 v3.3.0 // indirect
4545
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
4646
github.com/apache/thrift v0.21.0 // indirect
47-
github.com/aws/aws-sdk-go v1.55.6 // indirect
47+
github.com/aws/aws-sdk-go v1.55.8 // indirect
4848
github.com/benbjohnson/clock v1.3.5 // indirect
4949
github.com/beorn7/perks v1.0.1 // indirect
5050
github.com/blang/semver/v4 v4.0.0 // indirect
@@ -70,7 +70,6 @@ require (
7070
github.com/golang/mock v1.7.0-rc.1 // indirect
7171
github.com/golang/snappy v1.0.0 // indirect
7272
github.com/gomarkdown/markdown v0.0.0-20250311123330-531bef5e742b // indirect
73-
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect
7473
github.com/google/s2a-go v0.1.9 // indirect
7574
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
7675
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
@@ -79,7 +78,6 @@ require (
7978
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect
8079
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
8180
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
82-
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
8381
github.com/huandu/xstrings v1.5.0 // indirect
8482
github.com/iancoleman/strcase v0.3.0 // indirect
8583
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -104,7 +102,6 @@ require (
104102
github.com/ncruces/go-strftime v0.1.9 // indirect
105103
github.com/olivere/elastic/v7 v7.0.32 // indirect
106104
github.com/opentracing/opentracing-go v1.2.0 // indirect
107-
github.com/pborman/uuid v1.2.1 // indirect
108105
github.com/pkg/errors v0.9.1 // indirect
109106
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
110107
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
@@ -147,17 +144,17 @@ require (
147144
go.opentelemetry.io/otel/trace v1.35.0 // indirect
148145
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
149146
go.uber.org/atomic v1.11.0 // indirect
150-
go.uber.org/dig v1.18.1 // indirect
151-
go.uber.org/fx v1.23.0 // indirect
152-
go.uber.org/mock v0.5.0 // indirect
147+
go.uber.org/dig v1.19.0 // indirect
148+
go.uber.org/fx v1.24.0 // indirect
149+
go.uber.org/mock v0.6.0 // indirect
153150
go.uber.org/multierr v1.11.0 // indirect
154151
go.uber.org/zap v1.27.0 // indirect
155152
golang.org/x/crypto v0.38.0 // indirect
156-
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
153+
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
157154
golang.org/x/net v0.40.0 // indirect
158155
golang.org/x/oauth2 v0.30.0 // indirect
159-
golang.org/x/sync v0.14.0 // indirect
160-
golang.org/x/sys v0.33.0 // indirect
156+
golang.org/x/sync v0.16.0 // indirect
157+
golang.org/x/sys v0.37.0 // indirect
161158
golang.org/x/text v0.25.0 // indirect
162159
golang.org/x/time v0.11.0 // indirect
163160
google.golang.org/api v0.228.0 // indirect
@@ -166,12 +163,7 @@ require (
166163
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
167164
gopkg.in/inf.v0 v0.9.1 // indirect
168165
gopkg.in/validator.v2 v2.0.1 // indirect
169-
modernc.org/cc/v4 v4.25.2 // indirect
170-
modernc.org/gc/v2 v2.6.5 // indirect
171-
modernc.org/gc/v3 v3.0.0 // indirect
172-
modernc.org/libc v1.55.3 // indirect
166+
modernc.org/libc v1.66.10 // indirect
173167
modernc.org/mathutil v1.7.1 // indirect
174-
modernc.org/memory v1.9.1 // indirect
175-
modernc.org/strutil v1.2.1 // indirect
176-
modernc.org/token v1.1.0 // indirect
168+
modernc.org/memory v1.11.0 // indirect
177169
)

go.sum

Lines changed: 38 additions & 43 deletions
Large diffs are not rendered by default.

temporalcli/commands.gen.go

Lines changed: 56 additions & 4 deletions
Large diffs are not rendered by default.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package temporalcli
2+
3+
import (
4+
"go.temporal.io/api/workflowservice/v1"
5+
)
6+
7+
func (c *TemporalWorkflowPauseCommand) run(cctx *CommandContext, args []string) error {
8+
cl, err := c.Parent.ClientOptions.dialClient(cctx)
9+
if err != nil {
10+
return err
11+
}
12+
defer cl.Close()
13+
14+
_, err = cl.WorkflowService().PauseWorkflowExecution(cctx, &workflowservice.PauseWorkflowExecutionRequest{
15+
Namespace: c.Parent.Namespace,
16+
Reason: c.Reason,
17+
WorkflowId: c.WorkflowId,
18+
RunId: c.RunId,
19+
Identity: c.Parent.Identity,
20+
})
21+
if err != nil {
22+
return err
23+
}
24+
25+
cctx.Printer.Println("Workflow Execution paused")
26+
return nil
27+
}
28+
29+
func (c *TemporalWorkflowUnpauseCommand) run(cctx *CommandContext, args []string) error {
30+
cl, err := c.Parent.ClientOptions.dialClient(cctx)
31+
if err != nil {
32+
return err
33+
}
34+
defer cl.Close()
35+
36+
_, err = cl.WorkflowService().UnpauseWorkflowExecution(cctx, &workflowservice.UnpauseWorkflowExecutionRequest{
37+
Namespace: c.Parent.Namespace,
38+
Reason: c.Reason,
39+
WorkflowId: c.WorkflowId,
40+
RunId: c.RunId,
41+
Identity: c.Parent.Identity,
42+
})
43+
if err != nil {
44+
return err
45+
}
46+
47+
return nil
48+
}

temporalcli/commands.workflow_reset_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"go.temporal.io/sdk/worker"
2020
"go.temporal.io/sdk/workflow"
2121
"go.temporal.io/server/common/rpc"
22-
"go.temporal.io/server/common/searchattribute"
22+
"go.temporal.io/server/common/searchattribute/sadefs"
2323
"go.temporal.io/server/common/worker_versioning"
2424
)
2525

@@ -871,8 +871,8 @@ func (sut *batchResetTestData) waitBlockOnNonDeterministicError() {
871871

872872
// wait for it to appear in visibility
873873
query := fmt.Sprintf(`%s = "%s" and %s = "%s"`,
874-
searchattribute.ExecutionStatus, "Running",
875-
searchattribute.BuildIds, worker_versioning.UnversionedBuildIdSearchAttribute(sut.internalVersionFor("v2")))
874+
sadefs.ExecutionStatus, "Running",
875+
sadefs.BuildIds, worker_versioning.UnversionedBuildIdSearchAttribute(sut.internalVersionFor("v2")))
876876
sut.assert.Eventually(func() bool {
877877
resp, err := sut.client.ListWorkflow(sut.ctx, &workflowservice.ListWorkflowExecutionsRequest{
878878
Namespace: sut.namespace,

temporalcli/commandsgen/commands.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ commands:
360360
361361
Either `activity-id`, `activity-type`, or `--match-all` must be specified.
362362
363-
Activity options can be updated in bulk with a visibility query list filter.
363+
Activity options can be updated in bulk with a visibility query list filter.
364364
For example, if you want to reset for activities of type Foo, do:
365365
366366
```
@@ -592,7 +592,7 @@ commands:
592592
593593
Either `activity-id`, `activity-type`, or `--match-all` must be specified.
594594
595-
Activities can be reset in bulk with a visibility query list filter.
595+
Activities can be reset in bulk with a visibility query list filter.
596596
For example, if you want to reset activities of type Foo:
597597
598598
```
@@ -4248,6 +4248,34 @@ commands:
42484248
description: |
42494249
Assume update inputs are base64-encoded and attempt to decode them.
42504250
4251+
- name: temporal workflow pause
4252+
summary: 'Pause a Workflow Execution (Experimental feature)'
4253+
description: |
4254+
Pause a Workflow Execution.
4255+
Note: This is an experimental feature and may change in the future.
4256+
options:
4257+
- name: reason
4258+
type: string
4259+
description: |
4260+
Reason for pausing the Workflow Execution.
4261+
Defaults to message with the current user's name.
4262+
option-sets:
4263+
- workflow-reference
4264+
4265+
- name: temporal workflow unpause
4266+
summary: 'Unpause a previously paused Workflow Execution (Experimental feature)'
4267+
description: |
4268+
Unpause a previously paused Workflow Execution.
4269+
Note: This is an experimental feature and may change in the future.
4270+
options:
4271+
- name: reason
4272+
type: string
4273+
description: |
4274+
Reason for unpausing the Workflow Execution.
4275+
Defaults to message with the current user's name.
4276+
option-sets:
4277+
- workflow-reference
4278+
42514279
option-sets:
42524280
- name: client
42534281
options:

temporalcli/devserver/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func (s *StartOptions) buildServerOptions() ([]temporal.ServerOption, error) {
246246

247247
// Dynamic config if set
248248
for k, v := range s.DynamicConfigValues {
249-
dynConf[dynamicconfig.Key(k)] = v
249+
dynConf[dynamicconfig.MakeKey(k)] = v
250250
}
251251
opts = append(opts, temporal.WithDynamicConfigClient(dynConf))
252252

temporalcli/sqlite_test.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)