Skip to content

Commit 44017dc

Browse files
authored
Single workflow pause API (#8605)
## What changed? Note: This API is part of an experimental feature - "pause single workflow" - Added a new API (in Frontend & History) to pause workflow execution. - Updated DescribeWorkflowExecution API to show the pause info. - Added a dynamic config to control the access to this feature. The PauseWorkflowExecution API fails if the config is not set. - Added simple acceptance functional tests. These tests will evolve and new ones added as the feature implementation progresses. Followup PRs: - Idempotency check in pause api. - Validate input sizes. - Intercept workflow task creation. - Intercept and pause activities. - Unpause API ## Why? This API is needed to implement the "pause single workflow" feature. ## How did you test it? - [x] built - [x] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [x] added new functional test(s) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds a PauseWorkflowExecution API across frontend/history, wires clients/GRPC/mocks, surfaces pause info in DescribeWorkflowExecution, gates via new WorkflowPauseEnabled config, and adds functional tests. > > - **APIs/Protos**: > - Add `PauseWorkflowExecutionRequest/Response` messages in `api/historyservice/v1/request_response.proto` and generated Go files. > - Extend `HistoryService` with `PauseWorkflowExecution` RPC (server, client, grpc, mocks). > - **Frontend**: > - Implement `WorkflowHandler.PauseWorkflowExecution`, resolving namespace, invoking history, and gating by `WorkflowPauseEnabled`. > - Wire new config in `service.go`. > - **History**: > - Implement handler `PauseWorkflowExecution` in engine and new API `service/history/api/pauseworkflow` to add paused event and handle running-state checks. > - Enhance `DescribeWorkflowExecution` to include `PauseInfo` in `WorkflowExtendedInfo`. > - **Clients**: > - Add client methods (`client_gen`, `metric_client_gen`, `retryable_client_gen`) and historyservice mocks. > - **Config**: > - Introduce `dynamicconfig.WorkflowPauseEnabled` (namespace-scoped) and thread through frontend config. > - **Telemetry/Logging**: > - Add log tags for `PauseWorkflowExecution` and include RPC in telemetry interceptor. > - **Tests**: > - Add functional tests `tests/pause_workflow_execution_test.go` covering enabled/disabled scenarios. > - **Dependencies**: > - Bump `go.temporal.io/api` version. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 23e9f46. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 2cd597c commit 44017dc

File tree

24 files changed

+1219
-539
lines changed

24 files changed

+1219
-539
lines changed

api/historyservice/v1/request_response.go-helpers.pb.go

Lines changed: 74 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/historyservice/v1/request_response.pb.go

Lines changed: 476 additions & 379 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/historyservice/v1/service.pb.go

Lines changed: 153 additions & 148 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/historyservice/v1/service_grpc.pb.go

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/historyservicemock/v1/service_grpc.pb.mock.go

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/history/client_gen.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/history/metric_client_gen.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/history/retryable_client_gen.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/dynamicconfig/constants.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,8 +1378,8 @@ second per poller by one physical queue manager`,
13781378
MatchingEnableWorkerPluginMetrics = NewGlobalBoolSetting(
13791379
"matching.enableWorkerPluginMetrics",
13801380
false,
1381-
`MatchingEnableWorkerPluginMetrics controls whether to export worker plugin metrics.
1382-
The metric has 2 dimensions: namespace_id and plugin_name. Disabled by default as this is
1381+
`MatchingEnableWorkerPluginMetrics controls whether to export worker plugin metrics.
1382+
The metric has 2 dimensions: namespace_id and plugin_name. Disabled by default as this is
13831383
an optional feature and also requires a metrics collection system that can handle higher cardinalities.`,
13841384
)
13851385

@@ -1657,13 +1657,13 @@ NOTE: The outbound queue has a separate configuration: outboundQueueMaxPredicate
16571657
QueueMoveGroupTaskCountBase = NewGlobalIntSetting(
16581658
"history.queueMoveGroupTaskCountBase",
16591659
500,
1660-
`The base number of pending tasks count for a task group to be moved to the next level reader.
1660+
`The base number of pending tasks count for a task group to be moved to the next level reader.
16611661
The actual count is calculated as base * (multiplier ^ level)`,
16621662
)
16631663
QueueMoveGroupTaskCountMultiplier = NewGlobalFloatSetting(
16641664
"history.queueMoveGroupTaskCountMultiplier",
16651665
3.0,
1666-
`The multiplier used to calculate the number of pending tasks for a task group to be moved to the next level reader.
1666+
`The multiplier used to calculate the number of pending tasks for a task group to be moved to the next level reader.
16671667
The actual count is calculated as base * (multiplier ^ level)`,
16681668
)
16691669

@@ -2943,4 +2943,10 @@ WorkerActivitiesPerSecond, MaxConcurrentActivityTaskPollers.
29432943
false,
29442944
`WorkerCommandsEnabled is a "feature enable" flag. It allows clients to send commands to the workers.`,
29452945
)
2946+
2947+
WorkflowPauseEnabled = NewNamespaceBoolSetting(
2948+
"frontend.WorkflowPauseEnabled",
2949+
false,
2950+
`WorkflowPauseEnabled is a "feature enable" flag. When enabled it allows clients to pause workflows.`,
2951+
)
29462952
)

common/rpc/interceptor/logtags/history_service_server_gen.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)