From 87301b494b3ed7861aa475012c04a5a2fec6d96e Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 8 Feb 2026 04:57:03 -0500 Subject: [PATCH 01/30] Bump SDK --- go.mod | 6 +++--- go.sum | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 53d5eb404..4e8cb0ec7 100644 --- a/go.mod +++ b/go.mod @@ -17,11 +17,11 @@ require ( github.com/stretchr/testify v1.10.0 github.com/temporalio/cli/cliext v0.0.0 github.com/temporalio/ui-server/v2 v2.45.0 - go.temporal.io/api v1.60.1 - go.temporal.io/sdk v1.38.0 + go.temporal.io/api v1.62.0 + go.temporal.io/sdk v1.39.1-0.20260205231726-1a609f101fd5 go.temporal.io/sdk/contrib/envconfig v0.1.0 - golang.org/x/mod v0.31.0 go.temporal.io/server v1.30.0 + golang.org/x/mod v0.31.0 golang.org/x/term v0.38.0 golang.org/x/tools v0.40.0 google.golang.org/grpc v1.72.2 diff --git a/go.sum b/go.sum index dfca7e65b..d74e7c020 100644 --- a/go.sum +++ b/go.sum @@ -379,10 +379,10 @@ go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= -go.temporal.io/api v1.60.1 h1:UO3T3LE69LvKd/WU5TjsAJ+/s/wpiMA2i51xkajsbXY= -go.temporal.io/api v1.60.1/go.mod h1:iaxoP/9OXMJcQkETTECfwYq4cw/bj4nwov8b3ZLVnXM= -go.temporal.io/sdk v1.38.0 h1:4Bok5LEdED7YKpsSjIa3dDqram5VOq+ydBf4pyx0Wo4= -go.temporal.io/sdk v1.38.0/go.mod h1:a+R2Ej28ObvHoILbHaxMyind7M6D+W0L7edt5UJF4SE= +go.temporal.io/api v1.62.0 h1:rh7LqqV+pxaLNwPLsFRZgYoDJ/NvCNDv0EnWe6oS7A4= +go.temporal.io/api v1.62.0/go.mod h1:iaxoP/9OXMJcQkETTECfwYq4cw/bj4nwov8b3ZLVnXM= +go.temporal.io/sdk v1.39.1-0.20260205231726-1a609f101fd5 h1:MQKBR9kOVu5TQJ73aRySrYzHWxk6BPNog5572mlWV7I= +go.temporal.io/sdk v1.39.1-0.20260205231726-1a609f101fd5/go.mod h1:0OvuRsar0dG7vSqOcShIE3mx6unDJGBxtcopFyuYVKg= go.temporal.io/sdk/contrib/envconfig v0.1.0 h1:s+G/Ujph+Xl2jzLiiIm2T1vuijDkUL4Kse49dgDVGBE= go.temporal.io/sdk/contrib/envconfig v0.1.0/go.mod h1:FQEO3C56h9C7M6sDgSanB8HnBTmopw9qgVx4F1S6pJk= go.temporal.io/server v1.30.0 h1:g6JStvvmh4qhPhZ94lPipms7hwGLs4IB63a2PcIOC3M= From 9439326f37103b4973189ca7b057b58bd60ef2ca Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 8 Feb 2026 05:00:27 -0500 Subject: [PATCH 02/30] Bump server --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4e8cb0ec7..77e590d41 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( go.temporal.io/api v1.62.0 go.temporal.io/sdk v1.39.1-0.20260205231726-1a609f101fd5 go.temporal.io/sdk/contrib/envconfig v0.1.0 - go.temporal.io/server v1.30.0 + go.temporal.io/server v1.31.0-150.0 golang.org/x/mod v0.31.0 golang.org/x/term v0.38.0 golang.org/x/tools v0.40.0 diff --git a/go.sum b/go.sum index d74e7c020..ee6c1a8ab 100644 --- a/go.sum +++ b/go.sum @@ -385,8 +385,8 @@ go.temporal.io/sdk v1.39.1-0.20260205231726-1a609f101fd5 h1:MQKBR9kOVu5TQJ73aRyS go.temporal.io/sdk v1.39.1-0.20260205231726-1a609f101fd5/go.mod h1:0OvuRsar0dG7vSqOcShIE3mx6unDJGBxtcopFyuYVKg= go.temporal.io/sdk/contrib/envconfig v0.1.0 h1:s+G/Ujph+Xl2jzLiiIm2T1vuijDkUL4Kse49dgDVGBE= go.temporal.io/sdk/contrib/envconfig v0.1.0/go.mod h1:FQEO3C56h9C7M6sDgSanB8HnBTmopw9qgVx4F1S6pJk= -go.temporal.io/server v1.30.0 h1:g6JStvvmh4qhPhZ94lPipms7hwGLs4IB63a2PcIOC3M= -go.temporal.io/server v1.30.0/go.mod h1:tERB4Wh+w/LFgJqe0flHEkAuYOLEXkE/J6e2fiQOTaI= +go.temporal.io/server v1.31.0-150.0 h1:oYtbmXj0cUMpIYzOAaQcZGyIId8MmJomjArb6kg/MYk= +go.temporal.io/server v1.31.0-150.0/go.mod h1:Fq5MBJueEQ2GxH564BuZzPlvWExeAihwJGxp4RV8/zk= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= From 21c6e40487a61bcc9a2469d201dcae970bd21f6a Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 8 Feb 2026 06:41:04 -0500 Subject: [PATCH 03/30] Add standalone activity CLI command definitions Define 9 new commands under `temporal activity` for standalone (top-level) Activity Executions: start, execute, describe, list, count, cancel, terminate, delete, result. Each mirrors the corresponding `temporal workflow` command pattern. Modify `complete` and `fail` to make --workflow-id optional so they work for both workflow-scoped and standalone Activities. Add two new reusable option sets: `activity-execution-reference` (activity-id + run-id) and `activity-start` (full set of start options including timeouts, retry policy, ID policies, search attributes, headers, metadata, and priority). All new commands are marked Experimental. Existing workflow-only commands (pause, unpause, reset, update-options) are unchanged. Co-authored-by: Cursor --- internal/temporalcli/commands.yaml | 405 +++++++++++++++++++++++++---- 1 file changed, 359 insertions(+), 46 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index ce311b230..e065e0412 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -146,36 +146,45 @@ commands: - common - name: temporal activity - summary: Complete, update, pause, unpause, reset or fail an Activity + summary: Operate on Activity Executions description: | - Update an Activity's options, manage activity lifecycle or update - an Activity's state to completed or failed. + Start, list, and manage Activity Executions. - Updating activity state marks an Activity as successfully finished or as - having encountered an error. + Start an Activity Execution (Experimental): + + ``` + temporal activity start \ + --activity-id YourActivityId \ + --type YourActivity \ + --task-queue YourTaskQueue \ + --input '{"some-key": "some-value"}' + ``` + + Complete an Activity manually: ``` temporal activity complete \ - --activity-id=YourActivityId \ - --workflow-id=YourWorkflowId \ - --result='{"YourResultKey": "YourResultValue"}' + --activity-id YourActivityId \ + --result '{"YourResultKey": "YourResultValue"}' ``` option-sets: - client docs: - description-header: >- - Learn how to use Temporal Activity commands for completing or failing - Activity Executions in your Workflow. Optimize your Temporal Workflow - management effectively. keywords: - activity + - activity start + - activity execute + - activity describe + - activity list + - activity count + - activity cancel + - activity terminate + - activity delete - activity complete - - activity update-options + - activity fail - activity pause - activity unpause - activity reset - - activity execution - - activity fail - cli reference - cli-feature - command-line-interface-cli @@ -184,16 +193,35 @@ commands: - Activities - Temporal CLI + - name: temporal activity cancel + summary: Send cancellation to an Activity Execution (Experimental) + description: | + Cancel a running Activity Execution: + + ``` + temporal activity cancel \ + --activity-id YourActivityId + ``` + + The Activity receives a cancellation request and can perform + cleanup before completing. + option-sets: + - activity-execution-reference + options: + - name: reason + type: string + description: Reason for cancellation. + - name: temporal activity complete summary: Complete an Activity description: | - Complete an Activity, marking it as successfully finished. Specify the - Activity ID and include a JSON result for the returned value: + Complete an Activity, marking it as successfully finished. + Specify the Activity ID and include a JSON result for the + returned value: ``` temporal activity complete \ --activity-id YourActivityId \ - --workflow-id YourWorkflowId \ --result '{"YourResultKey": "YourResultVal"}' ``` options: @@ -201,37 +229,137 @@ commands: type: string description: Activity ID to complete. required: true + - name: workflow-id + type: string + short: w + description: | + Workflow ID. Required for workflow-scoped Activities. + Omit for standalone Activities. + - name: run-id + type: string + short: r + description: Run ID. - name: result type: string description: Result `JSON` to return. required: true + + - name: temporal activity count + summary: Number of Activity Executions (Experimental) + description: | + Show a count of Activity Executions. Use `--query` to select + a subset: + + ``` + temporal activity count \ + --query YourQuery + ``` + options: + - name: query + type: string + short: q + description: Content for an SQL-like `QUERY` List Filter. + + - name: temporal activity delete + summary: Remove an Activity Execution (Experimental) + description: | + Delete an Activity Execution: + + ``` + temporal activity delete \ + --activity-id YourActivityId + ``` option-sets: - - workflow-reference + - activity-execution-reference + + - name: temporal activity describe + summary: Show Activity Execution info (Experimental) + description: | + Display information about an Activity Execution: + + ``` + temporal activity describe \ + --activity-id YourActivityId + ``` + option-sets: + - activity-execution-reference + options: + - name: raw + type: bool + description: Print properties without changing their format. + + - name: temporal activity execute + summary: Start a new Activity Execution and wait for completion (Experimental) + description: | + Start a new Activity Execution and block until it completes. + The result is printed to stdout: + + ``` + temporal activity execute \ + --activity-id YourActivityId \ + --type YourActivity \ + --task-queue YourTaskQueue \ + --input '{"some-key": "some-value"}' + ``` + option-sets: + - activity-start + - payload-input - name: temporal activity fail summary: Fail an Activity description: | - Fail an Activity, marking it as having encountered an error. Specify the - Activity and Workflow IDs: + Fail an Activity, marking it as having encountered an error. + Specify the Activity ID: ``` temporal activity fail \ - --activity-id YourActivityId \ - --workflow-id YourWorkflowId + --activity-id YourActivityId ``` options: - name: activity-id type: string description: Activity ID to fail. required: true + - name: workflow-id + type: string + short: w + description: | + Workflow ID. Required for workflow-scoped Activities. + Omit for standalone Activities. + - name: run-id + type: string + short: r + description: Run ID. - name: detail type: string description: Reason for failing the Activity (JSON). - name: reason type: string description: Reason for failing the Activity. - option-sets: - - workflow-reference + + - name: temporal activity list + summary: Show Activity Executions (Experimental) + description: | + List Activity Executions. Use `--query` to filter results: + + ``` + temporal activity list \ + --query YourQuery + ``` + options: + - name: query + short: q + type: string + description: Content for an SQL-like `QUERY` List Filter. + - name: limit + type: int + description: | + Maximum number of Activity Executions to display. + - name: page-size + type: int + description: | + Maximum number of Activity Executions to fetch + at a time from the server. - name: temporal activity update-options summary: Update Activity options @@ -533,6 +661,58 @@ commands: option-sets: - single-workflow-or-batch + - name: temporal activity result + summary: Wait for and print the result of an Activity Execution (Experimental) + description: | + Wait for an Activity Execution to complete and print the + result: + + ``` + temporal activity result \ + --activity-id YourActivityId + ``` + option-sets: + - activity-execution-reference + + - name: temporal activity start + summary: Start a new Activity Execution (Experimental) + description: | + Start a new Activity Execution. Returns the Activity ID and + Run ID: + + ``` + temporal activity start \ + --activity-id YourActivityId \ + --type YourActivity \ + --task-queue YourTaskQueue \ + --input '{"some-key": "some-value"}' + ``` + option-sets: + - activity-start + - payload-input + + - name: temporal activity terminate + summary: Forcefully end an Activity Execution (Experimental) + description: | + Terminate an Activity Execution: + + ``` + temporal activity terminate \ + --activity-id YourActivityId \ + --reason YourReason + ``` + + Activity code cannot see or respond to terminations. To + perform clean-up work, use `temporal activity cancel` instead. + option-sets: + - activity-execution-reference + options: + - name: reason + type: string + description: | + Reason for termination. + Defaults to message with the current user's name. + - name: temporal batch summary: Manage running batch jobs description: | @@ -1101,17 +1281,17 @@ commands: ``` temporal worker deployment manager-identity [command] [options] ``` - - When present, `ManagerIdentity` is the identity of the user that has the + + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. - + This is especially useful in environments where multiple users (such as CLI users and automated controllers) may interact with the same Worker Deployment. `ManagerIdentity` allows different users to communicate with one another about who is expected to make changes to the Worker Deployment. - + The current Manager Identity is returned with `describe`: ``` temporal worker deployment describe \ @@ -1130,12 +1310,12 @@ commands: summary: Set the Manager Identity of a Worker Deployment description: | Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - - When present, `ManagerIdentity` is the identity of the user that has the + + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. - + This is especially useful in environments where multiple users (such as CLI users and automated controllers) may interact with the same Worker Deployment. `ManagerIdentity` allows different users to communicate with one another about @@ -1144,7 +1324,7 @@ commands: ``` temporal worker deployment manager-identity set [options] ``` - + For example: ``` @@ -1154,17 +1334,17 @@ commands: --identity YourUserIdentity # optional, populated by CLI if not provided ``` - Sets the Manager Identity of the Deployment to the identity of the user making - this request. If you don't specifically pass an identity field, the CLI will + Sets the Manager Identity of the Deployment to the identity of the user making + this request. If you don't specifically pass an identity field, the CLI will generate your identity for you. - + For example: ``` temporal worker deployment manager-identity set \ --deployment-name DeploymentName \ --manager-identity NewManagerIdentity ``` - + Sets the Manager Identity of the Deployment to any string. options: @@ -1186,12 +1366,12 @@ commands: summary: Unset the Manager Identity of a Worker Deployment description: | Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - - When present, `ManagerIdentity` is the identity of the user that has the + + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. - + This is especially useful in environments where multiple users (such as CLI users and automated controllers) may interact with the same Worker Deployment. `ManagerIdentity` allows different users to communicate with one another about @@ -1200,7 +1380,7 @@ commands: ``` temporal worker deployment manager-identity unset [options] ``` - + For example: ``` @@ -1223,7 +1403,7 @@ commands: summary: List worker status information in a specific namespace (EXPERIMENTAL) description: | Get a list of workers to the specified namespace. - + ``` temporal worker list --namespace YourNamespace --query 'TaskQueue="YourTaskQueue"' ``` @@ -1240,7 +1420,7 @@ commands: summary: Returns information about a specific worker (EXPERIMENTAL) description: | Look up information of a specific worker. - + ``` temporal worker describe --namespace YourNamespace --worker-instance-key YourKey ``` @@ -2524,8 +2704,8 @@ commands: provided that they were assigned a Build ID. Note that task reachability status is deprecated in favor of Drainage Status - (ie. of a Drained or Draining Worker Deployment Version) and will be removed - in a future release. Also, determining task reachability incurs a non-trivial + (ie. of a Drained or Draining Worker Deployment Version) and will be removed + in a future release. Also, determining task reachability incurs a non-trivial computing cost. Task reachability states are reported per build ID. The state may be one of the @@ -4724,7 +4904,7 @@ option-sets: Temporal workflow headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times to set multiple Temporal headers. - Note: These are workflow headers, not gRPC headers. + Note: These are workflow headers, not gRPC headers. - name: workflow-update-options options: @@ -4746,3 +4926,136 @@ option-sets: description: When overriding to a `pinned` behavior, specifies the Build ID of the version to target. + + - name: activity-execution-reference + options: + - name: activity-id + type: string + short: a + description: Activity ID. + required: true + - name: run-id + type: string + short: r + description: | + Run ID. + If not set, targets the latest run. + + - name: activity-start + options: + - name: activity-id + type: string + short: a + description: Activity ID. + required: true + - name: type + type: string + description: Activity Type name. + required: true + aliases: + - name + - name: task-queue + type: string + description: Activity Task queue. + required: true + short: t + - name: schedule-to-close-timeout + type: duration + description: | + Maximum time for the Activity Execution, including + retries. Either this or "start-to-close-timeout" + is required. + - name: schedule-to-start-timeout + type: duration + description: | + Maximum time an Activity task can stay in a task + queue before a Worker picks it up. + - name: start-to-close-timeout + type: duration + description: | + Maximum time for a single Activity attempt. + Either this or "schedule-to-close-timeout" + is required. + - name: heartbeat-timeout + type: duration + description: | + Maximum time between successful Worker heartbeats. + - name: retry-initial-interval + type: duration + description: | + Interval of the first retry. + If "retry-backoff-coefficient" is 1.0, it is used + for all retries. + - name: retry-maximum-interval + type: duration + description: | + Maximum interval between retries. + - name: retry-backoff-coefficient + type: float + description: | + Coefficient for calculating the next retry interval. + Must be 1 or larger. + - name: retry-maximum-attempts + type: int + description: | + Maximum number of attempts. + Setting to 1 disables retries. + Setting to 0 means unlimited attempts. + - name: id-reuse-policy + type: string-enum + description: | + Re-use policy for the Activity ID when a previous + Execution has completed. + enum-values: + - AllowDuplicate + - AllowDuplicateFailedOnly + - RejectDuplicate + - name: id-conflict-policy + type: string-enum + description: | + Policy for handling a conflict when starting an + Activity with a duplicate Activity ID of a running + Execution. + enum-values: + - Fail + - UseExisting + - name: search-attribute + type: string[] + description: | + Search Attribute in `KEY=VALUE` format. + Keys must be identifiers, and values must be + JSON values. + Can be passed multiple times. + - name: headers + type: string[] + description: | + Temporal activity headers in 'KEY=VALUE' format. + Keys must be identifiers, and values must be + JSON values. + May be passed multiple times. + - name: static-summary + type: string + experimental: true + description: | + Static Activity summary for human consumption in UIs. + Uses Temporal Markdown formatting. + - name: static-details + type: string + experimental: true + description: | + Static Activity details for human consumption in UIs. + Uses Temporal Markdown formatting. + - name: priority-key + type: int + description: | + Priority key (1-5, lower = higher priority). + Default is 3 when not specified. + - name: fairness-key + type: string + description: | + Fairness key (max 64 bytes) for proportional task + dispatch. + - name: fairness-weight + type: float + description: | + Weight [0.001-1000] for this fairness key. From a0eebde7075c3566d5f02c0ab97aca2ace35e962 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 8 Feb 2026 13:19:41 -0500 Subject: [PATCH 04/30] Code review --- internal/temporalcli/commands.yaml | 144 +++++++++++++++++++++-------- 1 file changed, 104 insertions(+), 40 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index e065e0412..fbc67963b 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -181,6 +181,7 @@ commands: - activity terminate - activity delete - activity complete + - activity update-options - activity fail - activity pause - activity unpause @@ -193,9 +194,15 @@ commands: - Activities - Temporal CLI + TODO: Follow the Python SDK docstring more closely in referring to this as requesting + cancellation and explaining that it will only be delivered if the activity is heartbeating, + etc. do we only send cancellation requests with heartbeat responses, not with + attempt starts? What is the story for workflow activities? + - name: temporal activity cancel summary: Send cancellation to an Activity Execution (Experimental) description: | + Cancel a running Activity Execution: ``` @@ -206,7 +213,7 @@ commands: The Activity receives a cancellation request and can perform cleanup before completing. option-sets: - - activity-execution-reference + - activity-reference options: - name: reason type: string @@ -233,27 +240,33 @@ commands: type: string short: w description: | - Workflow ID. Required for workflow-scoped Activities. + Workflow ID. Required for workflow Activities. Omit for standalone Activities. - name: run-id type: string short: r description: Run ID. + TODO: is this accepted/used for standalone activity? - name: result type: string description: Result `JSON` to return. required: true - name: temporal activity count - summary: Number of Activity Executions (Experimental) + summary: Count Activity Executions (Experimental) description: | - Show a count of Activity Executions. Use `--query` to select + Return a count of Activity Executions. Use `--query` to select a subset: ``` temporal activity count \ --query YourQuery ``` + + TODO: show an example query + + Visit https://docs.temporal.io/visibility to read more about Search Attributes + and Query creation. See `temporal batch --help` for a quick reference. options: - name: query type: string @@ -261,7 +274,7 @@ commands: description: Content for an SQL-like `QUERY` List Filter. - name: temporal activity delete - summary: Remove an Activity Execution (Experimental) + summary: Delete an Activity Execution (Experimental) description: | Delete an Activity Execution: @@ -269,11 +282,16 @@ commands: temporal activity delete \ --activity-id YourActivityId ``` + + TODO: `workflow delete` says: + The removal executes asynchronously. If the Execution is Running, the Service + terminates it before deletion. + option-sets: - - activity-execution-reference + - activity-reference - name: temporal activity describe - summary: Show Activity Execution info (Experimental) + summary: Describe Activity Execution (Experimental) description: | Display information about an Activity Execution: @@ -282,14 +300,14 @@ commands: --activity-id YourActivityId ``` option-sets: - - activity-execution-reference + - activity-reference options: - name: raw type: bool description: Print properties without changing their format. - name: temporal activity execute - summary: Start a new Activity Execution and wait for completion (Experimental) + summary: Start an Activity Execution and wait for completion (Experimental) description: | Start a new Activity Execution and block until it completes. The result is printed to stdout: @@ -308,28 +326,42 @@ commands: - name: temporal activity fail summary: Fail an Activity description: | - Fail an Activity, marking it as having encountered an error. - Specify the Activity ID: + Fail an Activity, marking it as having encountered an error: ``` temporal activity fail \ --activity-id YourActivityId ``` options: + + TODO: Maybe we should create activity-reference option set that permits an optional workflow + ID? And a standalone-activity-reference for the ones supported for standalone only. I believe + when inlining run-id here you've lost the standard sentence abut how if omitted it will target + the last run, which suggests that sharing via activity-reference would prevent such mistakes. + - name: activity-id type: string description: Activity ID to fail. + + TODO: why no short? Isn't it 'short: a' elsewhere? Again, this suggests you should employ an option set. + required: true - name: workflow-id type: string short: w description: | - Workflow ID. Required for workflow-scoped Activities. + Workflow ID. Required for workflow Activities. Omit for standalone Activities. - name: run-id type: string short: r description: Run ID. + + TODO: This seems odd, to have one option named `detail`, and one named `reason`, and yet both + have the same semantics but differ in format. Check that this is correct, and how it is + exposed by the Go and Python SDKs. AsyncActivityHandle.fail in Python seems to expose a + different API; are they the same grpc method? + - name: detail type: string description: Reason for failing the Activity (JSON). @@ -346,11 +378,20 @@ commands: temporal activity list \ --query YourQuery ``` + Visit https://docs.temporal.io/visibility to read more about Search Attributes + and Query creation. See `temporal batch --help` for a quick reference. options: - name: query short: q type: string + + TODO: this pre-existing phrasing is word salad. To what does upper-case QUERY refer? Change throughout to + `Query used to filter (or `count` where appropriate) the results. Visit https://docs.temporal.io/visibility to read more about Search Attributes + and Query creation. See `temporal batch --help` for a quick reference.` + description: Content for an SQL-like `QUERY` List Filter. + + - name: limit type: int description: | @@ -367,6 +408,8 @@ commands: Update the options of a running Activity that were passed into it from a Workflow. Updates are incremental, only changing the specified options. + TODO: here and elsewhere (pause, unpause, reset etc) add a sentence stating that it is not supported for Standalone Activities. + For example: ``` @@ -396,6 +439,14 @@ commands: --query 'TemporalPauseInfo="property:activityType=Foo"' ... ``` + + TODO: what has this command to do with pause? Why TemporalPauseInfo? + + TODO: this needs to share code with the activity-start option set. If it is not able to simply + use it then we should factor out an option set that can be used. The timeout descriptions are + mosty better in activity-start (e.g. "Indicates how long the caller is willing to wait" is + horrible language). But there may be some good details in here to include in the final shared version. + options: - name: activity-id short: a @@ -662,9 +713,9 @@ commands: - single-workflow-or-batch - name: temporal activity result - summary: Wait for and print the result of an Activity Execution (Experimental) + summary: Wait for and output the result of an Activity Execution (Experimental) description: | - Wait for an Activity Execution to complete and print the + Wait for an Activity Execution to complete and output the result: ``` @@ -672,12 +723,12 @@ commands: --activity-id YourActivityId ``` option-sets: - - activity-execution-reference + - activity-reference - name: temporal activity start summary: Start a new Activity Execution (Experimental) description: | - Start a new Activity Execution. Returns the Activity ID and + Start a new Activity Execution. Outputs the Activity ID and Run ID: ``` @@ -692,7 +743,7 @@ commands: - payload-input - name: temporal activity terminate - summary: Forcefully end an Activity Execution (Experimental) + summary: Terminate an Activity Execution (Experimental) description: | Terminate an Activity Execution: @@ -705,13 +756,13 @@ commands: Activity code cannot see or respond to terminations. To perform clean-up work, use `temporal activity cancel` instead. option-sets: - - activity-execution-reference + - activity-reference options: - name: reason type: string description: | Reason for termination. - Defaults to message with the current user's name. + Defaults to a message with the current user's name. - name: temporal batch summary: Manage running batch jobs @@ -3542,7 +3593,7 @@ commands: - Workflows - name: temporal workflow cancel - summary: Send cancellation to Workflow Execution + summary: Send cancellation to a Workflow Execution description: | Canceling a running Workflow Execution records a `WorkflowExecutionCancelRequested` event in the Event History. The Service @@ -3570,9 +3621,9 @@ commands: - single-workflow-or-batch - name: temporal workflow count - summary: Number of Workflow Executions + summary: Count Workflow Executions description: | - Show a count of Workflow Executions, regardless of execution state (running, + Return a count of Workflow Executions, regardless of execution state (running, terminated, etc). Use `--query` to select a subset of Workflow Executions: ``` @@ -3580,6 +3631,8 @@ commands: --query YourQuery ``` + TODO: show an example query + Visit https://docs.temporal.io/visibility to read more about Search Attributes and Query creation. See `temporal batch --help` for a quick reference. options: @@ -3589,9 +3642,9 @@ commands: description: Content for an SQL-like `QUERY` List Filter. - name: temporal workflow delete - summary: Remove Workflow Execution + summary: Delete Workflow Execution description: | - Delete a Workflow Executions and its Event History: + Delete a Workflow Execution and its Event History: ``` temporal workflow delete \ @@ -3603,13 +3656,16 @@ commands: Visit https://docs.temporal.io/visibility to read more about Search Attributes and Query creation. See `temporal batch --help` for a quick reference. + + TODO: does this actually operate on batches and accept a query? It's not documented here, and + I don't see the functionality in DeleteWorkflowExecution. option-sets: - single-workflow-or-batch - name: temporal workflow describe - summary: Show Workflow Execution info + summary: Describe Workflow Execution description: | - Display information about a specific Workflow Execution: + Display information about a Workflow Execution: ``` temporal workflow describe \ @@ -3634,11 +3690,10 @@ commands: description: Print properties without changing their format. - name: temporal workflow execute - summary: Start new Workflow Execution + summary: Start a Workflow Execution and wait for completion description: | - Establish a new Workflow Execution and direct its progress to stdout. The - command blocks and returns when the Workflow Execution completes. If your - Workflow requires input, pass valid JSON: + Start a new Workflow Execution and direct its progress to stdout. The + command blocks and returns when the Workflow Execution completes: ``` temporal workflow execute @@ -3696,6 +3751,8 @@ commands: --query YourQuery ``` + TODO: show an example query + Visit https://docs.temporal.io/visibility to read more about Search Attributes and Query creation. See `temporal batch --help` for a quick reference. @@ -3927,9 +3984,11 @@ commands: - workflow-update-options - name: temporal workflow result - summary: Wait for and show the result of a Workflow Execution + summary: Wait for and output the result of a Workflow Execution description: | - Wait for and print the result of a Workflow Execution: + TODO: Let's use 'output' as the verb in such situations, rather than 'print' or 'return'. + + Wait for and output the result of a Workflow Execution: ``` temporal workflow result \ @@ -4067,9 +4126,9 @@ commands: - workflow-reference - name: temporal workflow start - summary: Initiate a Workflow Execution + summary: Start a Workflow Execution description: | - Start a new Workflow Execution. Returns the Workflow- and Run-IDs: + Start a new Workflow Execution. Outputs the Workflow ID and Run ID: ``` temporal workflow start \ @@ -4084,9 +4143,9 @@ commands: - payload-input - name: temporal workflow terminate - summary: Forcefully end a Workflow Execution + summary: Terminate a Workflow Execution description: | - Terminate a Workflow Execution: + Terminate (forcefully end) a Workflow Execution: ``` temporal workflow terminate \ @@ -4927,7 +4986,8 @@ option-sets: When overriding to a `pinned` behavior, specifies the Build ID of the version to target. - - name: activity-execution-reference + TODO: I changed this to activity-reference, for consistency with workflow-reference + - name: activity-reference options: - name: activity-id type: string @@ -4952,8 +5012,6 @@ option-sets: type: string description: Activity Type name. required: true - aliases: - - name - name: task-queue type: string description: Activity Task queue. @@ -4963,7 +5021,7 @@ option-sets: type: duration description: | Maximum time for the Activity Execution, including - retries. Either this or "start-to-close-timeout" + all retries. Either this or "start-to-close-timeout" is required. - name: schedule-to-start-timeout type: duration @@ -4980,6 +5038,12 @@ option-sets: type: duration description: | Maximum time between successful Worker heartbeats. + + TODO: I think there should be a retry-policy-options option set, even if it's not currently + shared. In fact, does the CLI not expose the retry policy when starting a workflow? It's + possible; I know we don't really recommend non-default retry policy for workflow (the whole + point of workflow is that it should not need retrying) + - name: retry-initial-interval type: duration description: | From a01405d429f190fb13c76915a168b48823517d80 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 8 Feb 2026 19:52:00 -0500 Subject: [PATCH 05/30] Address code review feedback on activity command definitions - cancel: Rewrite description following Python SDK style, explaining that cancellation is a request delivered via heartbeat response - complete/fail: Use activity-reference option set instead of inlining activity-id/run-id, fixing missing short flag and missing "latest run" description - fail: Clarify detail vs reason option descriptions (detail is the failure details payload; reason is the failure message) - count/list: Add example queries, improve query option descriptions, add visibility docs links - delete: Add note about async deletion and running activity termination (from proto docs) - execute: Use "output" instead of "printed" - update-options/pause/unpause/reset: Add "Not supported for standalone Activities" sentence - Remove resolved TODO comments Co-authored-by: Cursor --- internal/temporalcli/commands.yaml | 123 +++++++++-------------------- 1 file changed, 37 insertions(+), 86 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index fbc67963b..f55e70c6e 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -194,24 +194,22 @@ commands: - Activities - Temporal CLI - TODO: Follow the Python SDK docstring more closely in referring to this as requesting - cancellation and explaining that it will only be delivered if the activity is heartbeating, - etc. do we only send cancellation requests with heartbeat responses, not with - attempt starts? What is the story for workflow activities? - - name: temporal activity cancel - summary: Send cancellation to an Activity Execution (Experimental) + summary: Request cancellation of an Activity Execution (Experimental) description: | - - Cancel a running Activity Execution: + Request cancellation of an Activity Execution: ``` temporal activity cancel \ --activity-id YourActivityId ``` - The Activity receives a cancellation request and can perform - cleanup before completing. + Requesting cancellation does not immediately cancel the + Activity. If the Activity is heartbeating, a cancellation + error will be raised when the next heartbeat response is + received; if the Activity allows this error to propagate, the + Activity transitions to canceled status. If the Activity is + not heartbeating, this request has no effect on the Activity. option-sets: - activity-reference options: @@ -231,22 +229,15 @@ commands: --activity-id YourActivityId \ --result '{"YourResultKey": "YourResultVal"}' ``` + option-sets: + - activity-reference options: - - name: activity-id - type: string - description: Activity ID to complete. - required: true - name: workflow-id type: string short: w description: | Workflow ID. Required for workflow Activities. Omit for standalone Activities. - - name: run-id - type: string - short: r - description: Run ID. - TODO: is this accepted/used for standalone activity? - name: result type: string description: Result `JSON` to return. @@ -255,23 +246,22 @@ commands: - name: temporal activity count summary: Count Activity Executions (Experimental) description: | - Return a count of Activity Executions. Use `--query` to select + Return a count of Activity Executions. Use `--query` to count a subset: ``` temporal activity count \ - --query YourQuery + --query 'ActivityType="YourActivity"' ``` - TODO: show an example query - - Visit https://docs.temporal.io/visibility to read more about Search Attributes - and Query creation. See `temporal batch --help` for a quick reference. + Visit https://docs.temporal.io/visibility to read more about + Search Attributes and Query creation. options: - name: query type: string short: q - description: Content for an SQL-like `QUERY` List Filter. + description: | + Query to filter Activity Executions to count. - name: temporal activity delete summary: Delete an Activity Execution (Experimental) @@ -283,10 +273,8 @@ commands: --activity-id YourActivityId ``` - TODO: `workflow delete` says: - The removal executes asynchronously. If the Execution is Running, the Service - terminates it before deletion. - + The deletion executes asynchronously. If the Activity + Execution is running, it will be terminated before deletion. option-sets: - activity-reference @@ -310,7 +298,7 @@ commands: summary: Start an Activity Execution and wait for completion (Experimental) description: | Start a new Activity Execution and block until it completes. - The result is printed to stdout: + The result is output to stdout: ``` temporal activity execute \ @@ -332,42 +320,24 @@ commands: temporal activity fail \ --activity-id YourActivityId ``` + option-sets: + - activity-reference options: - - TODO: Maybe we should create activity-reference option set that permits an optional workflow - ID? And a standalone-activity-reference for the ones supported for standalone only. I believe - when inlining run-id here you've lost the standard sentence abut how if omitted it will target - the last run, which suggests that sharing via activity-reference would prevent such mistakes. - - - name: activity-id - type: string - description: Activity ID to fail. - - TODO: why no short? Isn't it 'short: a' elsewhere? Again, this suggests you should employ an option set. - - required: true - name: workflow-id type: string short: w description: | Workflow ID. Required for workflow Activities. Omit for standalone Activities. - - name: run-id - type: string - short: r - description: Run ID. - - TODO: This seems odd, to have one option named `detail`, and one named `reason`, and yet both - have the same semantics but differ in format. Check that this is correct, and how it is - exposed by the Go and Python SDKs. AsyncActivityHandle.fail in Python seems to expose a - different API; are they the same grpc method? - - name: detail type: string - description: Reason for failing the Activity (JSON). + description: | + Failure detail (JSON). Attached as the failure details + payload. - name: reason type: string - description: Reason for failing the Activity. + description: | + Failure reason. Attached as the failure message. - name: temporal activity list summary: Show Activity Executions (Experimental) @@ -376,22 +346,17 @@ commands: ``` temporal activity list \ - --query YourQuery + --query 'ActivityType="YourActivity"' ``` - Visit https://docs.temporal.io/visibility to read more about Search Attributes - and Query creation. See `temporal batch --help` for a quick reference. + + Visit https://docs.temporal.io/visibility to read more about + Search Attributes and Query creation. options: - name: query short: q type: string - - TODO: this pre-existing phrasing is word salad. To what does upper-case QUERY refer? Change throughout to - `Query used to filter (or `count` where appropriate) the results. Visit https://docs.temporal.io/visibility to read more about Search Attributes - and Query creation. See `temporal batch --help` for a quick reference.` - - description: Content for an SQL-like `QUERY` List Filter. - - + description: | + Query to filter the Activity Executions to list. - name: limit type: int description: | @@ -407,8 +372,7 @@ commands: description: | Update the options of a running Activity that were passed into it from a Workflow. Updates are incremental, only changing the specified options. - - TODO: here and elsewhere (pause, unpause, reset etc) add a sentence stating that it is not supported for Standalone Activities. + Not supported for standalone Activities. For example: @@ -439,14 +403,6 @@ commands: --query 'TemporalPauseInfo="property:activityType=Foo"' ... ``` - - TODO: what has this command to do with pause? Why TemporalPauseInfo? - - TODO: this needs to share code with the activity-start option set. If it is not able to simply - use it then we should factor out an option set that can be used. The timeout descriptions are - mosty better in activity-start (e.g. "Indicates how long the caller is willing to wait" is - horrible language). But there may be some good details in here to include in the final shared version. - options: - name: activity-id short: a @@ -522,7 +478,7 @@ commands: - name: temporal activity pause summary: Pause an Activity description: | - Pause an Activity. + Pause an Activity. Not supported for standalone Activities. If the Activity is not currently running (e.g. because it previously failed), it will not be run again until it is unpaused. @@ -565,6 +521,7 @@ commands: summary: Unpause an Activity description: | Re-schedule a previously-paused Activity for execution. + Not supported for standalone Activities. If the Activity is not running and is past its retry timeout, it will be scheduled immediately. Otherwise, it will be scheduled after its retry @@ -630,7 +587,8 @@ commands: - name: temporal activity reset summary: Reset an Activity description: | - Reset an activity. This restarts the activity as if it were first being + Reset an activity. Not supported for standalone Activities. + This restarts the activity as if it were first being scheduled. That is, it will reset both the number of attempts and the activity timeout, as well as, optionally, the [heartbeat details](#reset-heartbeats). @@ -4986,7 +4944,6 @@ option-sets: When overriding to a `pinned` behavior, specifies the Build ID of the version to target. - TODO: I changed this to activity-reference, for consistency with workflow-reference - name: activity-reference options: - name: activity-id @@ -5038,12 +4995,6 @@ option-sets: type: duration description: | Maximum time between successful Worker heartbeats. - - TODO: I think there should be a retry-policy-options option set, even if it's not currently - shared. In fact, does the CLI not expose the retry policy when starting a workflow? It's - possible; I know we don't really recommend non-default retry policy for workflow (the whole - point of workflow is that it should not need retrying) - - name: retry-initial-interval type: duration description: | From aeb688f9435c5004003ad981773dbbd930cde479 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 8 Feb 2026 21:00:39 -0500 Subject: [PATCH 06/30] Implement standalone activity CLI commands Phase 2: Run code generation producing command structs for all 9 new commands and 2 new option sets (ActivityReferenceOptions, ActivityStartOptions). Phase 3: Implement run() methods for all new commands: - start: calls StartActivityExecution, outputs activity ID and run ID - execute: calls StartActivityExecution + PollActivityExecution, outputs the activity result - describe: calls DescribeActivityExecution with include_input and include_outcome - list: calls ListActivityExecutions with pagination, table output - count: calls CountActivityExecutions with group support - cancel: calls RequestCancelActivityExecution - terminate: calls TerminateActivityExecution with default reason - delete: calls DeleteActivityExecution - result: calls PollActivityExecution, outputs the activity result Shared helper buildStartActivityRequest() constructs the gRPC request from ActivityStartOptions, handling retry policy, ID policies, search attributes, headers, user metadata, and priority. Shared helper printActivityOutcome() formats activity results for both text and JSON output modes. Also adds description-header to temporal activity docs (required by code generator) and fixes import aliasing (common/v1 -> commonpb). Co-authored-by: Cursor --- internal/temporalcli/commands.activity.go | 408 ++++++++++++++++++- internal/temporalcli/commands.gen.go | 454 +++++++++++++++++++--- internal/temporalcli/commands.yaml | 3 + 3 files changed, 799 insertions(+), 66 deletions(-) diff --git a/internal/temporalcli/commands.activity.go b/internal/temporalcli/commands.activity.go index bff15f986..bb15f1a1f 100644 --- a/internal/temporalcli/commands.activity.go +++ b/internal/temporalcli/commands.activity.go @@ -4,13 +4,17 @@ import ( "fmt" "time" + "github.com/google/uuid" "github.com/temporalio/cli/internal/printer" activitypb "go.temporal.io/api/activity/v1" "go.temporal.io/api/batch/v1" - "go.temporal.io/api/common/v1" + commonpb "go.temporal.io/api/common/v1" + enumspb "go.temporal.io/api/enums/v1" "go.temporal.io/api/failure/v1" + sdkpb "go.temporal.io/api/sdk/v1" taskqueuepb "go.temporal.io/api/taskqueue/v1" "go.temporal.io/api/workflowservice/v1" + "go.temporal.io/sdk/converter" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/fieldmaskpb" ) @@ -65,7 +69,7 @@ func (c *TemporalActivityFailCommand) run(cctx *CommandContext, args []string) e } defer cl.Close() - var detailPayloads *common.Payloads + var detailPayloads *commonpb.Payloads if len(c.Detail) > 0 { metadata := map[string][][]byte{"encoding": {[]byte("json/plain")}} detailPayloads, err = CreatePayloads([][]byte{[]byte(c.Detail)}, metadata, false) @@ -133,7 +137,7 @@ func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args [] c.Command.Flags().Changed("retry-maximum-interval") || c.Command.Flags().Changed("retry-backoff-coefficient") || c.Command.Flags().Changed("retry-maximum-attempts") { - activityOptions.RetryPolicy = &common.RetryPolicy{} + activityOptions.RetryPolicy = &commonpb.RetryPolicy{} } if c.Command.Flags().Changed("retry-initial-interval") { @@ -173,7 +177,7 @@ func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args [] if exec != nil { result, err := cl.WorkflowService().UpdateActivityOptions(cctx, &workflowservice.UpdateActivityOptionsRequest{ Namespace: c.Parent.Namespace, - Execution: &common.WorkflowExecution{ + Execution: &commonpb.WorkflowExecution{ WorkflowId: c.WorkflowId, RunId: c.RunId, }, @@ -241,7 +245,7 @@ func (c *TemporalActivityPauseCommand) run(cctx *CommandContext, args []string) request := &workflowservice.PauseActivityRequest{ Namespace: c.Parent.Namespace, - Execution: &common.WorkflowExecution{ + Execution: &commonpb.WorkflowExecution{ WorkflowId: c.WorkflowId, RunId: c.RunId, }, @@ -288,7 +292,7 @@ func (c *TemporalActivityUnpauseCommand) run(cctx *CommandContext, args []string if exec != nil { // single workflow operation request := &workflowservice.UnpauseActivityRequest{ Namespace: c.Parent.Namespace, - Execution: &common.WorkflowExecution{ + Execution: &commonpb.WorkflowExecution{ WorkflowId: c.WorkflowId, RunId: c.RunId, }, @@ -361,7 +365,7 @@ func (c *TemporalActivityResetCommand) run(cctx *CommandContext, args []string) if exec != nil { // single workflow operation request := &workflowservice.ResetActivityRequest{ Namespace: c.Parent.Namespace, - Execution: &common.WorkflowExecution{ + Execution: &commonpb.WorkflowExecution{ WorkflowId: c.WorkflowId, RunId: c.RunId, }, @@ -424,3 +428,393 @@ func (c *TemporalActivityResetCommand) run(cctx *CommandContext, args []string) return nil } + +func (c *TemporalActivityStartCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + req, err := buildStartActivityRequest(cctx, c.Parent, &c.ActivityStartOptions, &c.PayloadInputOptions) + if err != nil { + return err + } + resp, err := cl.WorkflowService().StartActivityExecution(cctx, req) + if err != nil { + return fmt.Errorf("failed starting activity: %w", err) + } + return cctx.Printer.PrintStructured(struct { + ActivityId string `json:"activityId"` + RunId string `json:"runId"` + Started bool `json:"started"` + }{ + ActivityId: c.ActivityId, + RunId: resp.RunId, + Started: resp.Started, + }, printer.StructuredOptions{}) +} + +func (c *TemporalActivityExecuteCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + req, err := buildStartActivityRequest(cctx, c.Parent, &c.ActivityStartOptions, &c.PayloadInputOptions) + if err != nil { + return err + } + startResp, err := cl.WorkflowService().StartActivityExecution(cctx, req) + if err != nil { + return fmt.Errorf("failed starting activity: %w", err) + } + pollResp, err := cl.WorkflowService().PollActivityExecution(cctx, &workflowservice.PollActivityExecutionRequest{ + Namespace: c.Parent.Namespace, + ActivityId: c.ActivityId, + RunId: startResp.RunId, + }) + if err != nil { + return fmt.Errorf("failed polling activity result: %w", err) + } + return printActivityOutcome(cctx, pollResp.Outcome) +} + +func (c *TemporalActivityDescribeCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + resp, err := cl.WorkflowService().DescribeActivityExecution(cctx, &workflowservice.DescribeActivityExecutionRequest{ + Namespace: c.Parent.Namespace, + ActivityId: c.ActivityId, + RunId: c.RunId, + IncludeInput: true, + IncludeOutcome: true, + }) + if err != nil { + return fmt.Errorf("failed describing activity: %w", err) + } + if c.Raw || cctx.JSONOutput { + return cctx.Printer.PrintStructured(resp, printer.StructuredOptions{}) + } + return cctx.Printer.PrintStructured(resp.Info, printer.StructuredOptions{}) +} + +func (c *TemporalActivityListCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + cctx.Printer.StartList() + defer cctx.Printer.EndList() + + var nextPageToken []byte + var execsProcessed int + for pageIndex := 0; ; pageIndex++ { + resp, err := cl.WorkflowService().ListActivityExecutions(cctx, &workflowservice.ListActivityExecutionsRequest{ + Namespace: c.Parent.Namespace, + PageSize: int32(c.PageSize), + NextPageToken: nextPageToken, + Query: c.Query, + }) + if err != nil { + return fmt.Errorf("failed listing activities: %w", err) + } + var textTable []map[string]any + for _, exec := range resp.Executions { + if c.Limit > 0 && execsProcessed >= c.Limit { + break + } + execsProcessed++ + if cctx.JSONOutput { + _ = cctx.Printer.PrintStructured(exec, printer.StructuredOptions{}) + } else { + textTable = append(textTable, map[string]any{ + "Status": exec.Status, + "ActivityId": exec.ActivityId, + "Type": exec.ActivityType.GetName(), + "StartTime": exec.ScheduleTime.AsTime(), + }) + } + } + if len(textTable) > 0 { + _ = cctx.Printer.PrintStructured(textTable, printer.StructuredOptions{ + Fields: []string{"Status", "ActivityId", "Type", "StartTime"}, + Table: &printer.TableOptions{NoHeader: pageIndex > 0}, + }) + } + nextPageToken = resp.NextPageToken + if len(nextPageToken) == 0 || (c.Limit > 0 && execsProcessed >= c.Limit) { + return nil + } + } +} + +func (c *TemporalActivityCountCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + resp, err := cl.WorkflowService().CountActivityExecutions(cctx, &workflowservice.CountActivityExecutionsRequest{ + Namespace: c.Parent.Namespace, + Query: c.Query, + }) + if err != nil { + return fmt.Errorf("failed counting activities: %w", err) + } + if cctx.JSONOutput { + for _, group := range resp.Groups { + for _, payload := range group.GroupValues { + delete(payload.GetMetadata(), "type") + } + } + return cctx.Printer.PrintStructured(resp, printer.StructuredOptions{}) + } + cctx.Printer.Printlnf("Total: %v", resp.Count) + for _, group := range resp.Groups { + var valueStr string + for _, payload := range group.GroupValues { + var value any + if err := converter.GetDefaultDataConverter().FromPayload(payload, &value); err != nil { + value = fmt.Sprintf("", err) + } + if valueStr != "" { + valueStr += ", " + } + valueStr += fmt.Sprintf("%v", value) + } + cctx.Printer.Printlnf("Group total: %v, values: %v", group.Count, valueStr) + } + return nil +} + +func (c *TemporalActivityCancelCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + _, err = cl.WorkflowService().RequestCancelActivityExecution(cctx, &workflowservice.RequestCancelActivityExecutionRequest{ + Namespace: c.Parent.Namespace, + ActivityId: c.ActivityId, + RunId: c.RunId, + Identity: c.Parent.Identity, + RequestId: uuid.New().String(), + Reason: c.Reason, + }) + if err != nil { + return fmt.Errorf("failed to cancel activity: %w", err) + } + cctx.Printer.Println("Cancellation requested") + return nil +} + +func (c *TemporalActivityTerminateCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + reason := c.Reason + if reason == "" { + reason = defaultReason() + } + _, err = cl.WorkflowService().TerminateActivityExecution(cctx, &workflowservice.TerminateActivityExecutionRequest{ + Namespace: c.Parent.Namespace, + ActivityId: c.ActivityId, + RunId: c.RunId, + Identity: c.Parent.Identity, + RequestId: uuid.New().String(), + Reason: reason, + }) + if err != nil { + return fmt.Errorf("failed to terminate activity: %w", err) + } + cctx.Printer.Println("Activity terminated") + return nil +} + +func (c *TemporalActivityDeleteCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + _, err = cl.WorkflowService().DeleteActivityExecution(cctx, &workflowservice.DeleteActivityExecutionRequest{ + Namespace: c.Parent.Namespace, + ActivityId: c.ActivityId, + RunId: c.RunId, + }) + if err != nil { + return fmt.Errorf("failed to delete activity: %w", err) + } + cctx.Printer.Println("Delete activity succeeded") + return nil +} + +func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + resp, err := cl.WorkflowService().PollActivityExecution(cctx, &workflowservice.PollActivityExecutionRequest{ + Namespace: c.Parent.Namespace, + ActivityId: c.ActivityId, + RunId: c.RunId, + }) + if err != nil { + return fmt.Errorf("failed polling activity result: %w", err) + } + return printActivityOutcome(cctx, resp.Outcome) +} + +func buildStartActivityRequest( + cctx *CommandContext, + parent *TemporalActivityCommand, + opts *ActivityStartOptions, + inputOpts *PayloadInputOptions, +) (*workflowservice.StartActivityExecutionRequest, error) { + input, err := inputOpts.buildRawInputPayloads() + if err != nil { + return nil, err + } + + req := &workflowservice.StartActivityExecutionRequest{ + Namespace: parent.Namespace, + Identity: parent.Identity, + RequestId: uuid.New().String(), + ActivityId: opts.ActivityId, + ActivityType: &commonpb.ActivityType{ + Name: opts.Type, + }, + TaskQueue: &taskqueuepb.TaskQueue{ + Name: opts.TaskQueue, + }, + ScheduleToCloseTimeout: durationpb.New(opts.ScheduleToCloseTimeout.Duration()), + ScheduleToStartTimeout: durationpb.New(opts.ScheduleToStartTimeout.Duration()), + StartToCloseTimeout: durationpb.New(opts.StartToCloseTimeout.Duration()), + HeartbeatTimeout: durationpb.New(opts.HeartbeatTimeout.Duration()), + Input: input, + } + + if opts.RetryInitialInterval.Duration() > 0 || opts.RetryMaximumInterval.Duration() > 0 || + opts.RetryBackoffCoefficient > 0 || opts.RetryMaximumAttempts > 0 { + req.RetryPolicy = &commonpb.RetryPolicy{} + if opts.RetryInitialInterval.Duration() > 0 { + req.RetryPolicy.InitialInterval = durationpb.New(opts.RetryInitialInterval.Duration()) + } + if opts.RetryMaximumInterval.Duration() > 0 { + req.RetryPolicy.MaximumInterval = durationpb.New(opts.RetryMaximumInterval.Duration()) + } + if opts.RetryBackoffCoefficient > 0 { + req.RetryPolicy.BackoffCoefficient = float64(opts.RetryBackoffCoefficient) + } + if opts.RetryMaximumAttempts > 0 { + req.RetryPolicy.MaximumAttempts = int32(opts.RetryMaximumAttempts) + } + } + + if opts.IdReusePolicy.Value != "" { + v, err := stringToProtoEnum[enumspb.ActivityIdReusePolicy]( + opts.IdReusePolicy.Value, enumspb.ActivityIdReusePolicy_shorthandValue, enumspb.ActivityIdReusePolicy_value) + if err != nil { + return nil, fmt.Errorf("invalid activity ID reuse policy: %w", err) + } + req.IdReusePolicy = v + } + if opts.IdConflictPolicy.Value != "" { + v, err := stringToProtoEnum[enumspb.ActivityIdConflictPolicy]( + opts.IdConflictPolicy.Value, enumspb.ActivityIdConflictPolicy_shorthandValue, enumspb.ActivityIdConflictPolicy_value) + if err != nil { + return nil, fmt.Errorf("invalid activity ID conflict policy: %w", err) + } + req.IdConflictPolicy = v + } + + if len(opts.SearchAttribute) > 0 { + saMap, err := stringKeysJSONValues(opts.SearchAttribute, false) + if err != nil { + return nil, fmt.Errorf("invalid search attribute values: %w", err) + } + saPayloads, err := encodeMapToPayloads(saMap) + if err != nil { + return nil, fmt.Errorf("failed encoding search attributes: %w", err) + } + req.SearchAttributes = &commonpb.SearchAttributes{IndexedFields: saPayloads} + } + + if len(opts.Headers) > 0 { + headerMap, err := stringKeysJSONValues(opts.Headers, false) + if err != nil { + return nil, fmt.Errorf("invalid header values: %w", err) + } + headerPayloads, err := encodeMapToPayloads(headerMap) + if err != nil { + return nil, fmt.Errorf("failed encoding headers: %w", err) + } + req.Header = &commonpb.Header{Fields: headerPayloads} + } + + if opts.StaticSummary != "" || opts.StaticDetails != "" { + req.UserMetadata = &sdkpb.UserMetadata{} + if opts.StaticSummary != "" { + req.UserMetadata.Summary = &commonpb.Payload{ + Metadata: map[string][]byte{"encoding": []byte("json/plain")}, + Data: []byte(fmt.Sprintf("%q", opts.StaticSummary)), + } + } + if opts.StaticDetails != "" { + req.UserMetadata.Details = &commonpb.Payload{ + Metadata: map[string][]byte{"encoding": []byte("json/plain")}, + Data: []byte(fmt.Sprintf("%q", opts.StaticDetails)), + } + } + } + + if opts.PriorityKey > 0 || opts.FairnessKey != "" || opts.FairnessWeight > 0 { + req.Priority = &commonpb.Priority{ + PriorityKey: int32(opts.PriorityKey), + FairnessKey: opts.FairnessKey, + FairnessWeight: float32(opts.FairnessWeight), + } + } + + return req, nil +} + +func printActivityOutcome(cctx *CommandContext, outcome *activitypb.ActivityExecutionOutcome) error { + if outcome == nil { + return fmt.Errorf("activity outcome not available") + } + if cctx.JSONOutput { + return cctx.Printer.PrintStructured(outcome, printer.StructuredOptions{}) + } + if result := outcome.GetResult(); result != nil { + for _, payload := range result.Payloads { + var value any + if err := converter.GetDefaultDataConverter().FromPayload(payload, &value); err != nil { + cctx.Printer.Printlnf("Result: ", err) + } else { + cctx.Printer.Printlnf("Result: %v", value) + } + } + return nil + } + if f := outcome.GetFailure(); f != nil { + return fmt.Errorf("activity failed: %s", f.GetMessage()) + } + return fmt.Errorf("activity completed with unknown outcome") +} diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 8682b415b..7cc59eb42 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -340,6 +340,78 @@ func (v *WorkflowUpdateOptionsOptions) BuildFlags(f *pflag.FlagSet) { f.StringVar(&v.VersioningOverrideBuildId, "versioning-override-build-id", "", "When overriding to a `pinned` behavior, specifies the Build ID of the version to target.") } +type ActivityReferenceOptions struct { + ActivityId string + RunId string + FlagSet *pflag.FlagSet +} + +func (v *ActivityReferenceOptions) BuildFlags(f *pflag.FlagSet) { + v.FlagSet = f + f.StringVarP(&v.ActivityId, "activity-id", "a", "", "Activity ID. Required.") + _ = cobra.MarkFlagRequired(f, "activity-id") + f.StringVarP(&v.RunId, "run-id", "r", "", "Run ID. If not set, targets the latest run.") +} + +type ActivityStartOptions struct { + ActivityId string + Type string + TaskQueue string + ScheduleToCloseTimeout cliext.FlagDuration + ScheduleToStartTimeout cliext.FlagDuration + StartToCloseTimeout cliext.FlagDuration + HeartbeatTimeout cliext.FlagDuration + RetryInitialInterval cliext.FlagDuration + RetryMaximumInterval cliext.FlagDuration + RetryBackoffCoefficient float32 + RetryMaximumAttempts int + IdReusePolicy cliext.FlagStringEnum + IdConflictPolicy cliext.FlagStringEnum + SearchAttribute []string + Headers []string + StaticSummary string + StaticDetails string + PriorityKey int + FairnessKey string + FairnessWeight float32 + FlagSet *pflag.FlagSet +} + +func (v *ActivityStartOptions) BuildFlags(f *pflag.FlagSet) { + v.FlagSet = f + f.StringVarP(&v.ActivityId, "activity-id", "a", "", "Activity ID. Required.") + _ = cobra.MarkFlagRequired(f, "activity-id") + f.StringVar(&v.Type, "type", "", "Activity Type name. Required.") + _ = cobra.MarkFlagRequired(f, "type") + f.StringVarP(&v.TaskQueue, "task-queue", "t", "", "Activity Task queue. Required.") + _ = cobra.MarkFlagRequired(f, "task-queue") + v.ScheduleToCloseTimeout = 0 + f.Var(&v.ScheduleToCloseTimeout, "schedule-to-close-timeout", "Maximum time for the Activity Execution, including all retries. Either this or \"start-to-close-timeout\" is required.") + v.ScheduleToStartTimeout = 0 + f.Var(&v.ScheduleToStartTimeout, "schedule-to-start-timeout", "Maximum time an Activity task can stay in a task queue before a Worker picks it up.") + v.StartToCloseTimeout = 0 + f.Var(&v.StartToCloseTimeout, "start-to-close-timeout", "Maximum time for a single Activity attempt. Either this or \"schedule-to-close-timeout\" is required.") + v.HeartbeatTimeout = 0 + f.Var(&v.HeartbeatTimeout, "heartbeat-timeout", "Maximum time between successful Worker heartbeats.") + v.RetryInitialInterval = 0 + f.Var(&v.RetryInitialInterval, "retry-initial-interval", "Interval of the first retry. If \"retry-backoff-coefficient\" is 1.0, it is used for all retries.") + v.RetryMaximumInterval = 0 + f.Var(&v.RetryMaximumInterval, "retry-maximum-interval", "Maximum interval between retries.") + f.Float32Var(&v.RetryBackoffCoefficient, "retry-backoff-coefficient", 0, "Coefficient for calculating the next retry interval. Must be 1 or larger.") + f.IntVar(&v.RetryMaximumAttempts, "retry-maximum-attempts", 0, "Maximum number of attempts. Setting to 1 disables retries. Setting to 0 means unlimited attempts.") + v.IdReusePolicy = cliext.NewFlagStringEnum([]string{"AllowDuplicate", "AllowDuplicateFailedOnly", "RejectDuplicate"}, "") + f.Var(&v.IdReusePolicy, "id-reuse-policy", "Re-use policy for the Activity ID when a previous Execution has completed. Accepted values: AllowDuplicate, AllowDuplicateFailedOnly, RejectDuplicate.") + v.IdConflictPolicy = cliext.NewFlagStringEnum([]string{"Fail", "UseExisting"}, "") + f.Var(&v.IdConflictPolicy, "id-conflict-policy", "Policy for handling a conflict when starting an Activity with a duplicate Activity ID of a running Execution. Accepted values: Fail, UseExisting.") + f.StringArrayVar(&v.SearchAttribute, "search-attribute", nil, "Search Attribute in `KEY=VALUE` format. Keys must be identifiers, and values must be JSON values. Can be passed multiple times.") + f.StringArrayVar(&v.Headers, "headers", nil, "Temporal activity headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times.") + f.StringVar(&v.StaticSummary, "static-summary", "", "Static Activity summary for human consumption in UIs. Uses Temporal Markdown formatting. EXPERIMENTAL.") + f.StringVar(&v.StaticDetails, "static-details", "", "Static Activity details for human consumption in UIs. Uses Temporal Markdown formatting. EXPERIMENTAL.") + f.IntVar(&v.PriorityKey, "priority-key", 0, "Priority key (1-5, lower = higher priority). Default is 3 when not specified.") + f.StringVar(&v.FairnessKey, "fairness-key", "", "Fairness key (max 64 bytes) for proportional task dispatch.") + f.Float32Var(&v.FairnessWeight, "fairness-weight", 0, "Weight [0.001-1000] for this fairness key.") +} + type TemporalCommand struct { Command cobra.Command cliext.CommonOptions @@ -380,28 +452,66 @@ func NewTemporalActivityCommand(cctx *CommandContext, parent *TemporalCommand) * var s TemporalActivityCommand s.Parent = parent s.Command.Use = "activity" - s.Command.Short = "Complete, update, pause, unpause, reset or fail an Activity" + s.Command.Short = "Operate on Activity Executions" if hasHighlighting { - s.Command.Long = "Update an Activity's options, manage activity lifecycle or update\nan Activity's state to completed or failed.\n\nUpdating activity state marks an Activity as successfully finished or as\nhaving encountered an error.\n\n\x1b[1mtemporal activity complete \\\n --activity-id=YourActivityId \\\n --workflow-id=YourWorkflowId \\\n --result='{\"YourResultKey\": \"YourResultValue\"}'\x1b[0m" + s.Command.Long = "Start, list, and manage Activity Executions.\n\nStart an Activity Execution (Experimental):\n\n\x1b[1mtemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m\n\nComplete an Activity manually:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --result '{\"YourResultKey\": \"YourResultValue\"}'\x1b[0m" } else { - s.Command.Long = "Update an Activity's options, manage activity lifecycle or update\nan Activity's state to completed or failed.\n\nUpdating activity state marks an Activity as successfully finished or as\nhaving encountered an error.\n\n```\ntemporal activity complete \\\n --activity-id=YourActivityId \\\n --workflow-id=YourWorkflowId \\\n --result='{\"YourResultKey\": \"YourResultValue\"}'\n```" + s.Command.Long = "Start, list, and manage Activity Executions.\n\nStart an Activity Execution (Experimental):\n\n```\ntemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```\n\nComplete an Activity manually:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --result '{\"YourResultKey\": \"YourResultValue\"}'\n```" } s.Command.Args = cobra.NoArgs + s.Command.AddCommand(&NewTemporalActivityCancelCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityCompleteCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityCountCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityDeleteCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityDescribeCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityExecuteCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityFailCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityListCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityPauseCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityResetCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityResultCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityStartCommand(cctx, &s).Command) + s.Command.AddCommand(&NewTemporalActivityTerminateCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityUnpauseCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityUpdateOptionsCommand(cctx, &s).Command) s.ClientOptions.BuildFlags(s.Command.PersistentFlags()) return &s } +type TemporalActivityCancelCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + ActivityReferenceOptions + Reason string +} + +func NewTemporalActivityCancelCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityCancelCommand { + var s TemporalActivityCancelCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "cancel [flags]" + s.Command.Short = "Request cancellation of an Activity Execution (Experimental)" + if hasHighlighting { + s.Command.Long = "Request cancellation of an Activity Execution:\n\n\x1b[1mtemporal activity cancel \\\n --activity-id YourActivityId\x1b[0m\n\nRequesting cancellation does not immediately cancel the\nActivity. If the Activity is heartbeating, a cancellation\nerror will be raised when the next heartbeat response is\nreceived; if the Activity allows this error to propagate, the\nActivity transitions to canceled status. If the Activity is\nnot heartbeating, this request has no effect on the Activity." + } else { + s.Command.Long = "Request cancellation of an Activity Execution:\n\n```\ntemporal activity cancel \\\n --activity-id YourActivityId\n```\n\nRequesting cancellation does not immediately cancel the\nActivity. If the Activity is heartbeating, a cancellation\nerror will be raised when the next heartbeat response is\nreceived; if the Activity allows this error to propagate, the\nActivity transitions to canceled status. If the Activity is\nnot heartbeating, this request has no effect on the Activity." + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVar(&s.Reason, "reason", "", "Reason for cancellation.") + s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + type TemporalActivityCompleteCommand struct { Parent *TemporalActivityCommand Command cobra.Command - WorkflowReferenceOptions - ActivityId string + ActivityReferenceOptions + WorkflowId string Result string } @@ -412,16 +522,127 @@ func NewTemporalActivityCompleteCommand(cctx *CommandContext, parent *TemporalAc s.Command.Use = "complete [flags]" s.Command.Short = "Complete an Activity" if hasHighlighting { - s.Command.Long = "Complete an Activity, marking it as successfully finished. Specify the\nActivity ID and include a JSON result for the returned value:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\x1b[0m" + s.Command.Long = "Complete an Activity, marking it as successfully finished.\nSpecify the Activity ID and include a JSON result for the\nreturned value:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\x1b[0m" } else { - s.Command.Long = "Complete an Activity, marking it as successfully finished. Specify the\nActivity ID and include a JSON result for the returned value:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\n```" + s.Command.Long = "Complete an Activity, marking it as successfully finished.\nSpecify the Activity ID and include a JSON result for the\nreturned value:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\n```" } s.Command.Args = cobra.NoArgs - s.Command.Flags().StringVar(&s.ActivityId, "activity-id", "", "Activity ID to complete. Required.") - _ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id") + s.Command.Flags().StringVarP(&s.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required for workflow Activities. Omit for standalone Activities.") s.Command.Flags().StringVar(&s.Result, "result", "", "Result `JSON` to return. Required.") _ = cobra.MarkFlagRequired(s.Command.Flags(), "result") - s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) + s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalActivityCountCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + Query string +} + +func NewTemporalActivityCountCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityCountCommand { + var s TemporalActivityCountCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "count [flags]" + s.Command.Short = "Count Activity Executions (Experimental)" + if hasHighlighting { + s.Command.Long = "Return a count of Activity Executions. Use \x1b[1m--query\x1b[0m to count\na subset:\n\n\x1b[1mtemporal activity count \\\n --query 'ActivityType=\"YourActivity\"'\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and Query creation." + } else { + s.Command.Long = "Return a count of Activity Executions. Use `--query` to count\na subset:\n\n```\ntemporal activity count \\\n --query 'ActivityType=\"YourActivity\"'\n```\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and Query creation." + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Query to filter Activity Executions to count.") + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalActivityDeleteCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + ActivityReferenceOptions +} + +func NewTemporalActivityDeleteCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityDeleteCommand { + var s TemporalActivityDeleteCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "delete [flags]" + s.Command.Short = "Delete an Activity Execution (Experimental)" + if hasHighlighting { + s.Command.Long = "Delete an Activity Execution:\n\n\x1b[1mtemporal activity delete \\\n --activity-id YourActivityId\x1b[0m\n\nThe deletion executes asynchronously. If the Activity\nExecution is running, it will be terminated before deletion." + } else { + s.Command.Long = "Delete an Activity Execution:\n\n```\ntemporal activity delete \\\n --activity-id YourActivityId\n```\n\nThe deletion executes asynchronously. If the Activity\nExecution is running, it will be terminated before deletion." + } + s.Command.Args = cobra.NoArgs + s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalActivityDescribeCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + ActivityReferenceOptions + Raw bool +} + +func NewTemporalActivityDescribeCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityDescribeCommand { + var s TemporalActivityDescribeCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "describe [flags]" + s.Command.Short = "Describe Activity Execution (Experimental)" + if hasHighlighting { + s.Command.Long = "Display information about an Activity Execution:\n\n\x1b[1mtemporal activity describe \\\n --activity-id YourActivityId\x1b[0m" + } else { + s.Command.Long = "Display information about an Activity Execution:\n\n```\ntemporal activity describe \\\n --activity-id YourActivityId\n```" + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().BoolVar(&s.Raw, "raw", false, "Print properties without changing their format.") + s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalActivityExecuteCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + ActivityStartOptions + PayloadInputOptions +} + +func NewTemporalActivityExecuteCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityExecuteCommand { + var s TemporalActivityExecuteCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "execute [flags]" + s.Command.Short = "Start an Activity Execution and wait for completion (Experimental)" + if hasHighlighting { + s.Command.Long = "Start a new Activity Execution and block until it completes.\nThe result is output to stdout:\n\n\x1b[1mtemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" + } else { + s.Command.Long = "Start a new Activity Execution and block until it completes.\nThe result is output to stdout:\n\n```\ntemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" + } + s.Command.Args = cobra.NoArgs + s.ActivityStartOptions.BuildFlags(s.Command.Flags()) + s.PayloadInputOptions.BuildFlags(s.Command.Flags()) s.Command.Run = func(c *cobra.Command, args []string) { if err := s.run(cctx, args); err != nil { cctx.Options.Fail(err) @@ -433,8 +654,8 @@ func NewTemporalActivityCompleteCommand(cctx *CommandContext, parent *TemporalAc type TemporalActivityFailCommand struct { Parent *TemporalActivityCommand Command cobra.Command - WorkflowReferenceOptions - ActivityId string + ActivityReferenceOptions + WorkflowId string Detail string Reason string } @@ -446,16 +667,46 @@ func NewTemporalActivityFailCommand(cctx *CommandContext, parent *TemporalActivi s.Command.Use = "fail [flags]" s.Command.Short = "Fail an Activity" if hasHighlighting { - s.Command.Long = "Fail an Activity, marking it as having encountered an error. Specify the\nActivity and Workflow IDs:\n\n\x1b[1mtemporal activity fail \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\x1b[0m" + s.Command.Long = "Fail an Activity, marking it as having encountered an error:\n\n\x1b[1mtemporal activity fail \\\n --activity-id YourActivityId\x1b[0m" } else { - s.Command.Long = "Fail an Activity, marking it as having encountered an error. Specify the\nActivity and Workflow IDs:\n\n```\ntemporal activity fail \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n```" + s.Command.Long = "Fail an Activity, marking it as having encountered an error:\n\n```\ntemporal activity fail \\\n --activity-id YourActivityId\n```" } s.Command.Args = cobra.NoArgs - s.Command.Flags().StringVar(&s.ActivityId, "activity-id", "", "Activity ID to fail. Required.") - _ = cobra.MarkFlagRequired(s.Command.Flags(), "activity-id") - s.Command.Flags().StringVar(&s.Detail, "detail", "", "Reason for failing the Activity (JSON).") - s.Command.Flags().StringVar(&s.Reason, "reason", "", "Reason for failing the Activity.") - s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Flags().StringVarP(&s.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required for workflow Activities. Omit for standalone Activities.") + s.Command.Flags().StringVar(&s.Detail, "detail", "", "Failure detail (JSON). Attached as the failure details payload.") + s.Command.Flags().StringVar(&s.Reason, "reason", "", "Failure reason. Attached as the failure message.") + s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalActivityListCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + Query string + Limit int + PageSize int +} + +func NewTemporalActivityListCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityListCommand { + var s TemporalActivityListCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "list [flags]" + s.Command.Short = "Show Activity Executions (Experimental)" + if hasHighlighting { + s.Command.Long = "List Activity Executions. Use \x1b[1m--query\x1b[0m to filter results:\n\n\x1b[1mtemporal activity list \\\n --query 'ActivityType=\"YourActivity\"'\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and Query creation." + } else { + s.Command.Long = "List Activity Executions. Use `--query` to filter results:\n\n```\ntemporal activity list \\\n --query 'ActivityType=\"YourActivity\"'\n```\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and Query creation." + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Query to filter the Activity Executions to list.") + s.Command.Flags().IntVar(&s.Limit, "limit", 0, "Maximum number of Activity Executions to display.") + s.Command.Flags().IntVar(&s.PageSize, "page-size", 0, "Maximum number of Activity Executions to fetch at a time from the server.") s.Command.Run = func(c *cobra.Command, args []string) { if err := s.run(cctx, args); err != nil { cctx.Options.Fail(err) @@ -480,9 +731,9 @@ func NewTemporalActivityPauseCommand(cctx *CommandContext, parent *TemporalActiv s.Command.Use = "pause [flags]" s.Command.Short = "Pause an Activity" if hasHighlighting { - s.Command.Long = "Pause an Activity.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run until the next\ntime it fails, completes, or times out, at which point the pause will kick in.\n\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nActivities should be specified either by their Activity ID or Activity Type.\n\nFor example, specify the Activity and Workflow IDs like this:\n\n\x1b[1mtemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\x1b[0m\n\nTo later unpause the activity, see unpause. You may also want to\nreset the activity to unpause it while also starting it from the beginning." + s.Command.Long = "Pause an Activity. Not supported for standalone Activities.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run until the next\ntime it fails, completes, or times out, at which point the pause will kick in.\n\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nActivities should be specified either by their Activity ID or Activity Type.\n\nFor example, specify the Activity and Workflow IDs like this:\n\n\x1b[1mtemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\x1b[0m\n\nTo later unpause the activity, see unpause. You may also want to\nreset the activity to unpause it while also starting it from the beginning." } else { - s.Command.Long = "Pause an Activity.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run until the next\ntime it fails, completes, or times out, at which point the pause will kick in.\n\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nActivities should be specified either by their Activity ID or Activity Type.\n\nFor example, specify the Activity and Workflow IDs like this:\n\n```\ntemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n```\n\nTo later unpause the activity, see unpause. You may also want to\nreset the activity to unpause it while also starting it from the beginning." + s.Command.Long = "Pause an Activity. Not supported for standalone Activities.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run until the next\ntime it fails, completes, or times out, at which point the pause will kick in.\n\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nActivities should be specified either by their Activity ID or Activity Type.\n\nFor example, specify the Activity and Workflow IDs like this:\n\n```\ntemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n```\n\nTo later unpause the activity, see unpause. You may also want to\nreset the activity to unpause it while also starting it from the beginning." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "The Activity ID to pause. Either `activity-id` or `activity-type` must be provided, but not both.") @@ -518,9 +769,9 @@ func NewTemporalActivityResetCommand(cctx *CommandContext, parent *TemporalActiv s.Command.Use = "reset [flags]" s.Command.Short = "Reset an Activity" if hasHighlighting { - s.Command.Long = "Reset an activity. This restarts the activity as if it were first being\nscheduled. That is, it will reset both the number of attempts and the\nactivity timeout, as well as, optionally, the\nheartbeat details.\n\nIf the activity may be executing (i.e. it has not yet timed out), the\nreset will take effect the next time it fails, heartbeats, or times out.\nIf is waiting for a retry (i.e. has failed or timed out), the reset\nwill apply immediately.\n\nIf the activity is already paused, it will be unpaused by default.\nYou can specify \x1b[1mkeep_paused\x1b[0m to prevent this.\n\nIf the activity is paused and the \x1b[1mkeep_paused\x1b[0m flag is not provided,\nit will be unpaused. If the activity is paused and \x1b[1mkeep_paused\x1b[0m flag\nis provided - it will stay paused.\n\nActivities can be specified by their Activity ID or Activity Type.\n\n### Resetting activities that heartbeat {#reset-heartbeats}\n\nActivities that heartbeat will receive a Canceled failure\nthe next time they heartbeat after a reset.\n\nIf, in your Activity, you need to do any cleanup when an Activity is\nreset, handle this error and then re-throw it when you've cleaned up.\n\nIf the \x1b[1mreset_heartbeats\x1b[0m flag is set, the heartbeat details will also be cleared.\n\nSpecify the Activity Type of ID and Workflow IDs:\n\n\x1b[1mtemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --keep-paused\n --reset-heartbeats\x1b[0m\n\nEither \x1b[1mactivity-id\x1b[0m, \x1b[1mactivity-type\x1b[0m, or \x1b[1m--match-all\x1b[0m must be specified.\n\nActivities can be reset in bulk with a visibility query list filter.\nFor example, if you want to reset activities of type Foo:\n\n\x1b[1mtemporal activity reset \\\n --query 'TemporalResetInfo=\"property:activityType=Foo\"'\x1b[0m" + s.Command.Long = "Reset an activity. Not supported for standalone Activities.\nThis restarts the activity as if it were first being\nscheduled. That is, it will reset both the number of attempts and the\nactivity timeout, as well as, optionally, the\nheartbeat details.\n\nIf the activity may be executing (i.e. it has not yet timed out), the\nreset will take effect the next time it fails, heartbeats, or times out.\nIf is waiting for a retry (i.e. has failed or timed out), the reset\nwill apply immediately.\n\nIf the activity is already paused, it will be unpaused by default.\nYou can specify \x1b[1mkeep_paused\x1b[0m to prevent this.\n\nIf the activity is paused and the \x1b[1mkeep_paused\x1b[0m flag is not provided,\nit will be unpaused. If the activity is paused and \x1b[1mkeep_paused\x1b[0m flag\nis provided - it will stay paused.\n\nActivities can be specified by their Activity ID or Activity Type.\n\n### Resetting activities that heartbeat {#reset-heartbeats}\n\nActivities that heartbeat will receive a Canceled failure\nthe next time they heartbeat after a reset.\n\nIf, in your Activity, you need to do any cleanup when an Activity is\nreset, handle this error and then re-throw it when you've cleaned up.\n\nIf the \x1b[1mreset_heartbeats\x1b[0m flag is set, the heartbeat details will also be cleared.\n\nSpecify the Activity Type of ID and Workflow IDs:\n\n\x1b[1mtemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --keep-paused\n --reset-heartbeats\x1b[0m\n\nEither \x1b[1mactivity-id\x1b[0m, \x1b[1mactivity-type\x1b[0m, or \x1b[1m--match-all\x1b[0m must be specified.\n\nActivities can be reset in bulk with a visibility query list filter.\nFor example, if you want to reset activities of type Foo:\n\n\x1b[1mtemporal activity reset \\\n --query 'TemporalResetInfo=\"property:activityType=Foo\"'\x1b[0m" } else { - s.Command.Long = "Reset an activity. This restarts the activity as if it were first being\nscheduled. That is, it will reset both the number of attempts and the\nactivity timeout, as well as, optionally, the\nheartbeat details.\n\nIf the activity may be executing (i.e. it has not yet timed out), the\nreset will take effect the next time it fails, heartbeats, or times out.\nIf is waiting for a retry (i.e. has failed or timed out), the reset\nwill apply immediately.\n\nIf the activity is already paused, it will be unpaused by default.\nYou can specify `keep_paused` to prevent this.\n\nIf the activity is paused and the `keep_paused` flag is not provided,\nit will be unpaused. If the activity is paused and `keep_paused` flag\nis provided - it will stay paused.\n\nActivities can be specified by their Activity ID or Activity Type.\n\n### Resetting activities that heartbeat {#reset-heartbeats}\n\nActivities that heartbeat will receive a Canceled failure\nthe next time they heartbeat after a reset.\n\nIf, in your Activity, you need to do any cleanup when an Activity is\nreset, handle this error and then re-throw it when you've cleaned up.\n\nIf the `reset_heartbeats` flag is set, the heartbeat details will also be cleared.\n\nSpecify the Activity Type of ID and Workflow IDs:\n\n```\ntemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --keep-paused\n --reset-heartbeats\n```\n\nEither `activity-id`, `activity-type`, or `--match-all` must be specified.\n\nActivities can be reset in bulk with a visibility query list filter.\nFor example, if you want to reset activities of type Foo:\n\n```\ntemporal activity reset \\\n --query 'TemporalResetInfo=\"property:activityType=Foo\"'\n```" + s.Command.Long = "Reset an activity. Not supported for standalone Activities.\nThis restarts the activity as if it were first being\nscheduled. That is, it will reset both the number of attempts and the\nactivity timeout, as well as, optionally, the\nheartbeat details.\n\nIf the activity may be executing (i.e. it has not yet timed out), the\nreset will take effect the next time it fails, heartbeats, or times out.\nIf is waiting for a retry (i.e. has failed or timed out), the reset\nwill apply immediately.\n\nIf the activity is already paused, it will be unpaused by default.\nYou can specify `keep_paused` to prevent this.\n\nIf the activity is paused and the `keep_paused` flag is not provided,\nit will be unpaused. If the activity is paused and `keep_paused` flag\nis provided - it will stay paused.\n\nActivities can be specified by their Activity ID or Activity Type.\n\n### Resetting activities that heartbeat {#reset-heartbeats}\n\nActivities that heartbeat will receive a Canceled failure\nthe next time they heartbeat after a reset.\n\nIf, in your Activity, you need to do any cleanup when an Activity is\nreset, handle this error and then re-throw it when you've cleaned up.\n\nIf the `reset_heartbeats` flag is set, the heartbeat details will also be cleared.\n\nSpecify the Activity Type of ID and Workflow IDs:\n\n```\ntemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --keep-paused\n --reset-heartbeats\n```\n\nEither `activity-id`, `activity-type`, or `--match-all` must be specified.\n\nActivities can be reset in bulk with a visibility query list filter.\nFor example, if you want to reset activities of type Foo:\n\n```\ntemporal activity reset \\\n --query 'TemporalResetInfo=\"property:activityType=Foo\"'\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "The Activity ID to reset. Mutually exclusive with `--query`, `--match-all`, and `--activity-type`. Requires `--workflow-id` to be specified.") @@ -541,6 +792,91 @@ func NewTemporalActivityResetCommand(cctx *CommandContext, parent *TemporalActiv return &s } +type TemporalActivityResultCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + ActivityReferenceOptions +} + +func NewTemporalActivityResultCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityResultCommand { + var s TemporalActivityResultCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "result [flags]" + s.Command.Short = "Wait for and output the result of an Activity Execution (Experimental)" + if hasHighlighting { + s.Command.Long = "Wait for an Activity Execution to complete and output the\nresult:\n\n\x1b[1mtemporal activity result \\\n --activity-id YourActivityId\x1b[0m" + } else { + s.Command.Long = "Wait for an Activity Execution to complete and output the\nresult:\n\n```\ntemporal activity result \\\n --activity-id YourActivityId\n```" + } + s.Command.Args = cobra.NoArgs + s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalActivityStartCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + ActivityStartOptions + PayloadInputOptions +} + +func NewTemporalActivityStartCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityStartCommand { + var s TemporalActivityStartCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "start [flags]" + s.Command.Short = "Start a new Activity Execution (Experimental)" + if hasHighlighting { + s.Command.Long = "Start a new Activity Execution. Outputs the Activity ID and\nRun ID:\n\n\x1b[1mtemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" + } else { + s.Command.Long = "Start a new Activity Execution. Outputs the Activity ID and\nRun ID:\n\n```\ntemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" + } + s.Command.Args = cobra.NoArgs + s.ActivityStartOptions.BuildFlags(s.Command.Flags()) + s.PayloadInputOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + +type TemporalActivityTerminateCommand struct { + Parent *TemporalActivityCommand + Command cobra.Command + ActivityReferenceOptions + Reason string +} + +func NewTemporalActivityTerminateCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityTerminateCommand { + var s TemporalActivityTerminateCommand + s.Parent = parent + s.Command.DisableFlagsInUseLine = true + s.Command.Use = "terminate [flags]" + s.Command.Short = "Terminate an Activity Execution (Experimental)" + if hasHighlighting { + s.Command.Long = "Terminate an Activity Execution:\n\n\x1b[1mtemporal activity terminate \\\n --activity-id YourActivityId \\\n --reason YourReason\x1b[0m\n\nActivity code cannot see or respond to terminations. To\nperform clean-up work, use \x1b[1mtemporal activity cancel\x1b[0m instead." + } else { + s.Command.Long = "Terminate an Activity Execution:\n\n```\ntemporal activity terminate \\\n --activity-id YourActivityId \\\n --reason YourReason\n```\n\nActivity code cannot see or respond to terminations. To\nperform clean-up work, use `temporal activity cancel` instead." + } + s.Command.Args = cobra.NoArgs + s.Command.Flags().StringVar(&s.Reason, "reason", "", "Reason for termination. Defaults to a message with the current user's name.") + s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) + s.Command.Run = func(c *cobra.Command, args []string) { + if err := s.run(cctx, args); err != nil { + cctx.Options.Fail(err) + } + } + return &s +} + type TemporalActivityUnpauseCommand struct { Parent *TemporalActivityCommand Command cobra.Command @@ -560,9 +896,9 @@ func NewTemporalActivityUnpauseCommand(cctx *CommandContext, parent *TemporalAct s.Command.Use = "unpause [flags]" s.Command.Short = "Unpause an Activity" if hasHighlighting { - s.Command.Long = "Re-schedule a previously-paused Activity for execution.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires.\n\nUse \x1b[1m--reset-attempts\x1b[0m to reset the number of previous run attempts to\nzero. For example, if an Activity is near the maximum number of attempts\nN specified in its retry policy, \x1b[1m--reset-attempts\x1b[0m will allow the\nActivity to be retried another N times after unpausing.\n\nUse \x1b[1m--reset-heartbeat\x1b[0m to reset the Activity's heartbeats.\n\nActivities can be specified by their Activity ID or Activity Type.\nOne of those parameters must be provided.\n\nSpecify the Activity ID or Type and Workflow IDs:\n\n\x1b[1mtemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset-attempts\n --reset-heartbeats\x1b[0m\n\nActivities can be unpaused in bulk via a visibility Query list filter.\nFor example, if you want to unpause activities of type Foo that you\npreviously paused, do:\n\n\x1b[1mtemporal activity unpause \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\x1b[0m" + s.Command.Long = "Re-schedule a previously-paused Activity for execution.\nNot supported for standalone Activities.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires.\n\nUse \x1b[1m--reset-attempts\x1b[0m to reset the number of previous run attempts to\nzero. For example, if an Activity is near the maximum number of attempts\nN specified in its retry policy, \x1b[1m--reset-attempts\x1b[0m will allow the\nActivity to be retried another N times after unpausing.\n\nUse \x1b[1m--reset-heartbeat\x1b[0m to reset the Activity's heartbeats.\n\nActivities can be specified by their Activity ID or Activity Type.\nOne of those parameters must be provided.\n\nSpecify the Activity ID or Type and Workflow IDs:\n\n\x1b[1mtemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset-attempts\n --reset-heartbeats\x1b[0m\n\nActivities can be unpaused in bulk via a visibility Query list filter.\nFor example, if you want to unpause activities of type Foo that you\npreviously paused, do:\n\n\x1b[1mtemporal activity unpause \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\x1b[0m" } else { - s.Command.Long = "Re-schedule a previously-paused Activity for execution.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires.\n\nUse `--reset-attempts` to reset the number of previous run attempts to\nzero. For example, if an Activity is near the maximum number of attempts\nN specified in its retry policy, `--reset-attempts` will allow the\nActivity to be retried another N times after unpausing.\n\nUse `--reset-heartbeat` to reset the Activity's heartbeats.\n\nActivities can be specified by their Activity ID or Activity Type.\nOne of those parameters must be provided.\n\nSpecify the Activity ID or Type and Workflow IDs:\n\n```\ntemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset-attempts\n --reset-heartbeats\n```\n\nActivities can be unpaused in bulk via a visibility Query list filter.\nFor example, if you want to unpause activities of type Foo that you\npreviously paused, do:\n\n```\ntemporal activity unpause \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n```" + s.Command.Long = "Re-schedule a previously-paused Activity for execution.\nNot supported for standalone Activities.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires.\n\nUse `--reset-attempts` to reset the number of previous run attempts to\nzero. For example, if an Activity is near the maximum number of attempts\nN specified in its retry policy, `--reset-attempts` will allow the\nActivity to be retried another N times after unpausing.\n\nUse `--reset-heartbeat` to reset the Activity's heartbeats.\n\nActivities can be specified by their Activity ID or Activity Type.\nOne of those parameters must be provided.\n\nSpecify the Activity ID or Type and Workflow IDs:\n\n```\ntemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset-attempts\n --reset-heartbeats\n```\n\nActivities can be unpaused in bulk via a visibility Query list filter.\nFor example, if you want to unpause activities of type Foo that you\npreviously paused, do:\n\n```\ntemporal activity unpause \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "The Activity ID to unpause. Mutually exclusive with `--query`, `--match-all`, and `--activity-type`. Requires `--workflow-id` to be specified.") @@ -607,9 +943,9 @@ func NewTemporalActivityUpdateOptionsCommand(cctx *CommandContext, parent *Tempo s.Command.Use = "update-options [flags]" s.Command.Short = "Update Activity options" if hasHighlighting { - s.Command.Long = "Update the options of a running Activity that were passed into it from\na Workflow. Updates are incremental, only changing the specified options.\n\nFor example:\n\n\x1b[1mtemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\x1b[0m\n\nYou may follow this command with \x1b[1mtemporal activity reset\x1b[0m, and the new values will apply after the reset.\n\nEither \x1b[1mactivity-id\x1b[0m, \x1b[1mactivity-type\x1b[0m, or \x1b[1m--match-all\x1b[0m must be specified.\n\nActivity options can be updated in bulk with a visibility query list filter.\nFor example, if you want to reset for activities of type Foo, do:\n\n\x1b[1mtemporal activity update-options \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n ...\x1b[0m" + s.Command.Long = "Update the options of a running Activity that were passed into it from\na Workflow. Updates are incremental, only changing the specified options.\nNot supported for standalone Activities.\n\nFor example:\n\n\x1b[1mtemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\x1b[0m\n\nYou may follow this command with \x1b[1mtemporal activity reset\x1b[0m, and the new values will apply after the reset.\n\nEither \x1b[1mactivity-id\x1b[0m, \x1b[1mactivity-type\x1b[0m, or \x1b[1m--match-all\x1b[0m must be specified.\n\nActivity options can be updated in bulk with a visibility query list filter.\nFor example, if you want to reset for activities of type Foo, do:\n\n\x1b[1mtemporal activity update-options \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n ...\x1b[0m" } else { - s.Command.Long = "Update the options of a running Activity that were passed into it from\na Workflow. Updates are incremental, only changing the specified options.\n\nFor example:\n\n```\ntemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\n```\n\nYou may follow this command with `temporal activity reset`, and the new values will apply after the reset.\n\nEither `activity-id`, `activity-type`, or `--match-all` must be specified.\n\nActivity options can be updated in bulk with a visibility query list filter.\nFor example, if you want to reset for activities of type Foo, do:\n\n```\ntemporal activity update-options \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n ...\n```" + s.Command.Long = "Update the options of a running Activity that were passed into it from\na Workflow. Updates are incremental, only changing the specified options.\nNot supported for standalone Activities.\n\nFor example:\n\n```\ntemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\n```\n\nYou may follow this command with `temporal activity reset`, and the new values will apply after the reset.\n\nEither `activity-id`, `activity-type`, or `--match-all` must be specified.\n\nActivity options can be updated in bulk with a visibility query list filter.\nFor example, if you want to reset for activities of type Foo, do:\n\n```\ntemporal activity update-options \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n ...\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "The Activity ID to update options. Mutually exclusive with `--query`, `--match-all`, and `--activity-type`. Requires `--workflow-id` to be specified.") @@ -2263,9 +2599,9 @@ func NewTemporalTaskQueueDescribeCommand(cctx *CommandContext, parent *TemporalT s.Command.Use = "describe [flags]" s.Command.Short = "Show active Workers" if hasHighlighting { - s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A \x1b[1mLastAccessTime\x1b[0m over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue\x1b[0m\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\x1b[0m\n\nThis command provides the following task queue statistics:\n- \x1b[1mApproximateBacklogCount\x1b[0m: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- \x1b[1mApproximateBacklogAge\x1b[0m: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- \x1b[1mTasksAddRate\x1b[0m: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mTasksDispatchRate\x1b[0m: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mBacklogIncreaseRate\x1b[0m: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n \x1b[1mTasksAddRate\x1b[0m - \x1b[1mTasksDispatchRate\x1b[0m.\n\nNOTE: The \x1b[1mTasksAddRate\x1b[0m and \x1b[1mTasksDispatchRate\x1b[0m metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of \x1b[1mBacklogIncreaseRate\x1b[0m is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag \x1b[1m--report-reachability\x1b[0m:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\x1b[0m\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed \nin a future release. Also, determining task reachability incurs a non-trivial \ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- \x1b[1mReachable\x1b[0m: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- \x1b[1mClosedWorkflowsOnly\x1b[0m: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- \x1b[1mUnreachable\x1b[0m: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, \x1b[1mReachable\x1b[0m is\nmore conservative than \x1b[1mClosedWorkflowsOnly\x1b[0m." + s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A \x1b[1mLastAccessTime\x1b[0m over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue\x1b[0m\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\x1b[0m\n\nThis command provides the following task queue statistics:\n- \x1b[1mApproximateBacklogCount\x1b[0m: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- \x1b[1mApproximateBacklogAge\x1b[0m: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- \x1b[1mTasksAddRate\x1b[0m: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mTasksDispatchRate\x1b[0m: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mBacklogIncreaseRate\x1b[0m: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n \x1b[1mTasksAddRate\x1b[0m - \x1b[1mTasksDispatchRate\x1b[0m.\n\nNOTE: The \x1b[1mTasksAddRate\x1b[0m and \x1b[1mTasksDispatchRate\x1b[0m metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of \x1b[1mBacklogIncreaseRate\x1b[0m is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag \x1b[1m--report-reachability\x1b[0m:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\x1b[0m\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed\nin a future release. Also, determining task reachability incurs a non-trivial\ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- \x1b[1mReachable\x1b[0m: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- \x1b[1mClosedWorkflowsOnly\x1b[0m: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- \x1b[1mUnreachable\x1b[0m: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, \x1b[1mReachable\x1b[0m is\nmore conservative than \x1b[1mClosedWorkflowsOnly\x1b[0m." } else { - s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A `LastAccessTime` over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue\n```\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\n```\n\nThis command provides the following task queue statistics:\n- `ApproximateBacklogCount`: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- `ApproximateBacklogAge`: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- `TasksAddRate`: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `TasksDispatchRate`: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `BacklogIncreaseRate`: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n `TasksAddRate` - `TasksDispatchRate`.\n\nNOTE: The `TasksAddRate` and `TasksDispatchRate` metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of `BacklogIncreaseRate` is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag `--report-reachability`:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\n```\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed \nin a future release. Also, determining task reachability incurs a non-trivial \ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- `Reachable`: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- `ClosedWorkflowsOnly`: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- `Unreachable`: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, `Reachable` is\nmore conservative than `ClosedWorkflowsOnly`." + s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A `LastAccessTime` over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue\n```\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\n```\n\nThis command provides the following task queue statistics:\n- `ApproximateBacklogCount`: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- `ApproximateBacklogAge`: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- `TasksAddRate`: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `TasksDispatchRate`: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `BacklogIncreaseRate`: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n `TasksAddRate` - `TasksDispatchRate`.\n\nNOTE: The `TasksAddRate` and `TasksDispatchRate` metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of `BacklogIncreaseRate` is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag `--report-reachability`:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\n```\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed\nin a future release. Also, determining task reachability incurs a non-trivial\ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- `Reachable`: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- `ClosedWorkflowsOnly`: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- `Unreachable`: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, `Reachable` is\nmore conservative than `ClosedWorkflowsOnly`." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.TaskQueue, "task-queue", "t", "", "Task Queue name. Required.") @@ -3018,9 +3354,9 @@ func NewTemporalWorkerDeploymentManagerIdentityCommand(cctx *CommandContext, par s.Command.Use = "manager-identity" s.Command.Short = "Manager Identity commands change the `ManagerIdentity` of a Worker Deployment" if hasHighlighting { - s.Command.Long = "Manager Identity commands change the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment:\n\n\x1b[1mtemporal worker deployment manager-identity [command] [options]\x1b[0m\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with \x1b[1mdescribe\x1b[0m:\n\x1b[1m temporal worker deployment describe \\\n --deployment-name YourDeploymentName\x1b[0m" + s.Command.Long = "Manager Identity commands change the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment:\n\n\x1b[1mtemporal worker deployment manager-identity [command] [options]\x1b[0m\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with \x1b[1mdescribe\x1b[0m:\n\x1b[1m temporal worker deployment describe \\\n --deployment-name YourDeploymentName\x1b[0m" } else { - s.Command.Long = "Manager Identity commands change the `ManagerIdentity` of a Worker Deployment:\n\n```\ntemporal worker deployment manager-identity [command] [options]\n```\n\nWhen present, `ManagerIdentity` is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with `describe`:\n```\n temporal worker deployment describe \\\n --deployment-name YourDeploymentName\n```" + s.Command.Long = "Manager Identity commands change the `ManagerIdentity` of a Worker Deployment:\n\n```\ntemporal worker deployment manager-identity [command] [options]\n```\n\nWhen present, `ManagerIdentity` is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with `describe`:\n```\n temporal worker deployment describe \\\n --deployment-name YourDeploymentName\n```" } s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalWorkerDeploymentManagerIdentitySetCommand(cctx, &s).Command) @@ -3044,9 +3380,9 @@ func NewTemporalWorkerDeploymentManagerIdentitySetCommand(cctx *CommandContext, s.Command.Use = "set [flags]" s.Command.Short = "Set the Manager Identity of a Worker Deployment" if hasHighlighting { - s.Command.Long = "Set the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity set [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\x1b[0m\n\nSets the Manager Identity of the Deployment to the identity of the user making \nthis request. If you don't specifically pass an identity field, the CLI will \ngenerate your identity for you.\n\nFor example:\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\x1b[0m\n\nSets the Manager Identity of the Deployment to any string." + s.Command.Long = "Set the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity set [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\x1b[0m\n\nSets the Manager Identity of the Deployment to the identity of the user making\nthis request. If you don't specifically pass an identity field, the CLI will\ngenerate your identity for you.\n\nFor example:\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\x1b[0m\n\nSets the Manager Identity of the Deployment to any string." } else { - s.Command.Long = "Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity set [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\n```\n\nSets the Manager Identity of the Deployment to the identity of the user making \nthis request. If you don't specifically pass an identity field, the CLI will \ngenerate your identity for you.\n\nFor example:\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\n```\n\nSets the Manager Identity of the Deployment to any string." + s.Command.Long = "Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity set [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\n```\n\nSets the Manager Identity of the Deployment to the identity of the user making\nthis request. If you don't specifically pass an identity field, the CLI will\ngenerate your identity for you.\n\nFor example:\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\n```\n\nSets the Manager Identity of the Deployment to any string." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.ManagerIdentity, "manager-identity", "", "New Manager Identity. Required unless --self is specified.") @@ -3075,9 +3411,9 @@ func NewTemporalWorkerDeploymentManagerIdentityUnsetCommand(cctx *CommandContext s.Command.Use = "unset [flags]" s.Command.Short = "Unset the Manager Identity of a Worker Deployment" if hasHighlighting { - s.Command.Long = "Unset the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity unset [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\x1b[0m\n\nClears the Manager Identity field for a given Deployment." + s.Command.Long = "Unset the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity unset [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\x1b[0m\n\nClears the Manager Identity field for a given Deployment." } else { - s.Command.Long = "Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity unset [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\n```\n\nClears the Manager Identity field for a given Deployment." + s.Command.Long = "Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity unset [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\n```\n\nClears the Manager Identity field for a given Deployment." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.DeploymentName, "deployment-name", "", "Name for a Worker Deployment. Required.") @@ -3304,7 +3640,7 @@ func NewTemporalWorkflowCancelCommand(cctx *CommandContext, parent *TemporalWork s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "cancel [flags]" - s.Command.Short = "Send cancellation to Workflow Execution" + s.Command.Short = "Send cancellation to a Workflow Execution" if hasHighlighting { s.Command.Long = "Canceling a running Workflow Execution records a\n\x1b[1mWorkflowExecutionCancelRequested\x1b[0m event in the Event History. The Service\nschedules a new Command Task, and the Workflow Execution performs any cleanup\nwork supported by its implementation.\n\nUse the Workflow ID to cancel an Execution:\n\n\x1b[1mtemporal workflow cancel \\\n --workflow-id YourWorkflowId\x1b[0m\n\nA visibility Query lets you send bulk cancellations to Workflow Executions\nmatching the results:\n\n\x1b[1mtemporal workflow cancel \\\n --query YourQuery\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." } else { @@ -3331,11 +3667,11 @@ func NewTemporalWorkflowCountCommand(cctx *CommandContext, parent *TemporalWorkf s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "count [flags]" - s.Command.Short = "Number of Workflow Executions" + s.Command.Short = "Count Workflow Executions" if hasHighlighting { - s.Command.Long = "Show a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use \x1b[1m--query\x1b[0m to select a subset of Workflow Executions:\n\n\x1b[1mtemporal workflow count \\\n --query YourQuery\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." + s.Command.Long = "Return a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use \x1b[1m--query\x1b[0m to select a subset of Workflow Executions:\n\n\x1b[1mtemporal workflow count \\\n --query YourQuery\x1b[0m\n\nTODO: show an example query\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." } else { - s.Command.Long = "Show a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use `--query` to select a subset of Workflow Executions:\n\n```\ntemporal workflow count \\\n --query YourQuery\n```\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." + s.Command.Long = "Return a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use `--query` to select a subset of Workflow Executions:\n\n```\ntemporal workflow count \\\n --query YourQuery\n```\n\nTODO: show an example query\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Content for an SQL-like `QUERY` List Filter.") @@ -3358,11 +3694,11 @@ func NewTemporalWorkflowDeleteCommand(cctx *CommandContext, parent *TemporalWork s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "delete [flags]" - s.Command.Short = "Remove Workflow Execution" + s.Command.Short = "Delete Workflow Execution" if hasHighlighting { - s.Command.Long = "Delete a Workflow Executions and its Event History:\n\n\x1b[1mtemporal workflow delete \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." + s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n\x1b[1mtemporal workflow delete \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference.\n\nTODO: does this actually operate on batches and accept a query? It's not documented here, and\nI don't see the functionality in DeleteWorkflowExecution." } else { - s.Command.Long = "Delete a Workflow Executions and its Event History:\n\n```\ntemporal workflow delete \\\n --workflow-id YourWorkflowId\n```\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." + s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n```\ntemporal workflow delete \\\n --workflow-id YourWorkflowId\n```\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference.\n\nTODO: does this actually operate on batches and accept a query? It's not documented here, and\nI don't see the functionality in DeleteWorkflowExecution." } s.Command.Args = cobra.NoArgs s.SingleWorkflowOrBatchOptions.BuildFlags(s.Command.Flags()) @@ -3387,11 +3723,11 @@ func NewTemporalWorkflowDescribeCommand(cctx *CommandContext, parent *TemporalWo s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "describe [flags]" - s.Command.Short = "Show Workflow Execution info" + s.Command.Short = "Describe Workflow Execution" if hasHighlighting { - s.Command.Long = "Display information about a specific Workflow Execution:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId\x1b[0m\n\nShow the Workflow Execution's auto-reset points:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --reset-points true\x1b[0m" + s.Command.Long = "Display information about a Workflow Execution:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId\x1b[0m\n\nShow the Workflow Execution's auto-reset points:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --reset-points true\x1b[0m" } else { - s.Command.Long = "Display information about a specific Workflow Execution:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId\n```\n\nShow the Workflow Execution's auto-reset points:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --reset-points true\n```" + s.Command.Long = "Display information about a Workflow Execution:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId\n```\n\nShow the Workflow Execution's auto-reset points:\n\n```\ntemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --reset-points true\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().BoolVar(&s.ResetPoints, "reset-points", false, "Show auto-reset points only.") @@ -3419,11 +3755,11 @@ func NewTemporalWorkflowExecuteCommand(cctx *CommandContext, parent *TemporalWor s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "execute [flags]" - s.Command.Short = "Start new Workflow Execution" + s.Command.Short = "Start a Workflow Execution and wait for completion" if hasHighlighting { - s.Command.Long = "Establish a new Workflow Execution and direct its progress to stdout. The\ncommand blocks and returns when the Workflow Execution completes. If your\nWorkflow requires input, pass valid JSON:\n\n\x1b[1mtemporal workflow execute\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m\n\nUse \x1b[1m--event-details\x1b[0m to relay updates to the command-line output in JSON\nformat. When using JSON output (\x1b[1m--output json\x1b[0m), this includes the entire\n\"history\" JSON key for the run." + s.Command.Long = "Start a new Workflow Execution and direct its progress to stdout. The\ncommand blocks and returns when the Workflow Execution completes:\n\n\x1b[1mtemporal workflow execute\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m\n\nUse \x1b[1m--event-details\x1b[0m to relay updates to the command-line output in JSON\nformat. When using JSON output (\x1b[1m--output json\x1b[0m), this includes the entire\n\"history\" JSON key for the run." } else { - s.Command.Long = "Establish a new Workflow Execution and direct its progress to stdout. The\ncommand blocks and returns when the Workflow Execution completes. If your\nWorkflow requires input, pass valid JSON:\n\n```\ntemporal workflow execute\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```\n\nUse `--event-details` to relay updates to the command-line output in JSON\nformat. When using JSON output (`--output json`), this includes the entire\n\"history\" JSON key for the run." + s.Command.Long = "Start a new Workflow Execution and direct its progress to stdout. The\ncommand blocks and returns when the Workflow Execution completes:\n\n```\ntemporal workflow execute\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```\n\nUse `--event-details` to relay updates to the command-line output in JSON\nformat. When using JSON output (`--output json`), this includes the entire\n\"history\" JSON key for the run." } s.Command.Args = cobra.NoArgs s.Command.Flags().BoolVar(&s.Detailed, "detailed", false, "Display events as sections instead of table. Does not apply to JSON output.") @@ -3539,9 +3875,9 @@ func NewTemporalWorkflowListCommand(cctx *CommandContext, parent *TemporalWorkfl s.Command.Use = "list [flags]" s.Command.Short = "Show Workflow Executions" if hasHighlighting { - s.Command.Long = "List Workflow Executions. The optional \x1b[1m--query\x1b[0m limits the output to\nWorkflows matching a Query:\n\n\x1b[1mtemporal workflow list \\\n --query YourQuery\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference.\n\nView a list of archived Workflow Executions:\n\n\x1b[1mtemporal workflow list \\\n --archived\x1b[0m" + s.Command.Long = "List Workflow Executions. The optional \x1b[1m--query\x1b[0m limits the output to\nWorkflows matching a Query:\n\n\x1b[1mtemporal workflow list \\\n --query YourQuery\x1b[0m\n\nTODO: show an example query\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference.\n\nView a list of archived Workflow Executions:\n\n\x1b[1mtemporal workflow list \\\n --archived\x1b[0m" } else { - s.Command.Long = "List Workflow Executions. The optional `--query` limits the output to\nWorkflows matching a Query:\n\n```\ntemporal workflow list \\\n --query YourQuery\n```\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference.\n\nView a list of archived Workflow Executions:\n\n```\ntemporal workflow list \\\n --archived\n```" + s.Command.Long = "List Workflow Executions. The optional `--query` limits the output to\nWorkflows matching a Query:\n\n```\ntemporal workflow list \\\n --query YourQuery\n```\n\nTODO: show an example query\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference.\n\nView a list of archived Workflow Executions:\n\n```\ntemporal workflow list \\\n --archived\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Content for an SQL-like `QUERY` List Filter.") @@ -3731,11 +4067,11 @@ func NewTemporalWorkflowResultCommand(cctx *CommandContext, parent *TemporalWork s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "result [flags]" - s.Command.Short = "Wait for and show the result of a Workflow Execution" + s.Command.Short = "Wait for and output the result of a Workflow Execution" if hasHighlighting { - s.Command.Long = "Wait for and print the result of a Workflow Execution:\n\n\x1b[1mtemporal workflow result \\\n --workflow-id YourWorkflowId\x1b[0m" + s.Command.Long = "TODO: Let's use 'output' as the verb in such situations, rather than 'print' or 'return'.\n\nWait for and output the result of a Workflow Execution:\n\n\x1b[1mtemporal workflow result \\\n --workflow-id YourWorkflowId\x1b[0m" } else { - s.Command.Long = "Wait for and print the result of a Workflow Execution:\n\n```\ntemporal workflow result \\\n --workflow-id YourWorkflowId\n```" + s.Command.Long = "TODO: Let's use 'output' as the verb in such situations, rather than 'print' or 'return'.\n\nWait for and output the result of a Workflow Execution:\n\n```\ntemporal workflow result \\\n --workflow-id YourWorkflowId\n```" } s.Command.Args = cobra.NoArgs s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) @@ -3902,11 +4238,11 @@ func NewTemporalWorkflowStartCommand(cctx *CommandContext, parent *TemporalWorkf s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "start [flags]" - s.Command.Short = "Initiate a Workflow Execution" + s.Command.Short = "Start a Workflow Execution" if hasHighlighting { - s.Command.Long = "Start a new Workflow Execution. Returns the Workflow- and Run-IDs:\n\n\x1b[1mtemporal workflow start \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" + s.Command.Long = "Start a new Workflow Execution. Outputs the Workflow ID and Run ID:\n\n\x1b[1mtemporal workflow start \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" } else { - s.Command.Long = "Start a new Workflow Execution. Returns the Workflow- and Run-IDs:\n\n```\ntemporal workflow start \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" + s.Command.Long = "Start a new Workflow Execution. Outputs the Workflow ID and Run ID:\n\n```\ntemporal workflow start \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" } s.Command.Args = cobra.NoArgs s.SharedWorkflowStartOptions.BuildFlags(s.Command.Flags()) @@ -3995,11 +4331,11 @@ func NewTemporalWorkflowTerminateCommand(cctx *CommandContext, parent *TemporalW s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "terminate [flags]" - s.Command.Short = "Forcefully end a Workflow Execution" + s.Command.Short = "Terminate a Workflow Execution" if hasHighlighting { - s.Command.Long = "Terminate a Workflow Execution:\n\n\x1b[1mtemporal workflow terminate \\\n --reason YourReasonForTermination \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe reason is optional and defaults to the current user's name. The reason\nis stored in the Event History as part of the \x1b[1mWorkflowExecutionTerminated\x1b[0m\nevent. This becomes the closing Event in the Workflow Execution's history.\n\nExecutions may be terminated in bulk via a visibility Query list filter:\n\n\x1b[1mtemporal workflow terminate \\\n --query YourQuery \\\n --reason YourReasonForTermination\x1b[0m\n\nWorkflow code cannot see or respond to terminations. To perform clean-up work\nin your Workflow code, use \x1b[1mtemporal workflow cancel\x1b[0m instead.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." + s.Command.Long = "Terminate (forcefully end) a Workflow Execution:\n\n\x1b[1mtemporal workflow terminate \\\n --reason YourReasonForTermination \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe reason is optional and defaults to the current user's name. The reason\nis stored in the Event History as part of the \x1b[1mWorkflowExecutionTerminated\x1b[0m\nevent. This becomes the closing Event in the Workflow Execution's history.\n\nExecutions may be terminated in bulk via a visibility Query list filter:\n\n\x1b[1mtemporal workflow terminate \\\n --query YourQuery \\\n --reason YourReasonForTermination\x1b[0m\n\nWorkflow code cannot see or respond to terminations. To perform clean-up work\nin your Workflow code, use \x1b[1mtemporal workflow cancel\x1b[0m instead.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." } else { - s.Command.Long = "Terminate a Workflow Execution:\n\n```\ntemporal workflow terminate \\\n --reason YourReasonForTermination \\\n --workflow-id YourWorkflowId\n```\n\nThe reason is optional and defaults to the current user's name. The reason\nis stored in the Event History as part of the `WorkflowExecutionTerminated`\nevent. This becomes the closing Event in the Workflow Execution's history.\n\nExecutions may be terminated in bulk via a visibility Query list filter:\n\n```\ntemporal workflow terminate \\\n --query YourQuery \\\n --reason YourReasonForTermination\n```\n\nWorkflow code cannot see or respond to terminations. To perform clean-up work\nin your Workflow code, use `temporal workflow cancel` instead.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." + s.Command.Long = "Terminate (forcefully end) a Workflow Execution:\n\n```\ntemporal workflow terminate \\\n --reason YourReasonForTermination \\\n --workflow-id YourWorkflowId\n```\n\nThe reason is optional and defaults to the current user's name. The reason\nis stored in the Event History as part of the `WorkflowExecutionTerminated`\nevent. This becomes the closing Event in the Workflow Execution's history.\n\nExecutions may be terminated in bulk via a visibility Query list filter:\n\n```\ntemporal workflow terminate \\\n --query YourQuery \\\n --reason YourReasonForTermination\n```\n\nWorkflow code cannot see or respond to terminations. To perform clean-up work\nin your Workflow code, use `temporal workflow cancel` instead.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.WorkflowId, "workflow-id", "w", "", "Workflow ID. You must set either --workflow-id or --query.") diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index f55e70c6e..be846d1f4 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -170,6 +170,9 @@ commands: option-sets: - client docs: + description-header: >- + Start, list, and manage Activity Executions + using the Temporal CLI. keywords: - activity - activity start From f1d418587b24a36ad66f48c5c9587e6540e9ab99 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 8 Feb 2026 21:03:16 -0500 Subject: [PATCH 07/30] Add tests for standalone activity command structure Verify all 11 activity subcommands appear in help output (cancel, complete, count, delete, describe, execute, fail, list, result, start, terminate). Verify start command exposes expected flags (activity-id, type, task-queue, timeouts, input). Verify complete and fail commands expose both activity-reference options (activity-id, run-id) and the optional workflow-id flag. Integration tests for the new RPCs are deferred until a standalone-activity-enabled test server is available. Co-authored-by: Cursor --- .../temporalcli/commands.activity_test.go | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/internal/temporalcli/commands.activity_test.go b/internal/temporalcli/commands.activity_test.go index 28ff7a13b..79273789a 100644 --- a/internal/temporalcli/commands.activity_test.go +++ b/internal/temporalcli/commands.activity_test.go @@ -5,8 +5,10 @@ import ( "fmt" "sync" "sync/atomic" + "testing" "time" + "github.com/stretchr/testify/assert" "go.temporal.io/api/enums/v1" "go.temporal.io/api/history/v1" "go.temporal.io/api/serviceerror" @@ -519,3 +521,48 @@ func (s *SharedServerSuite) TestResetActivity_BatchSuccess() { // unblock the activities to let them finish failActivity.Store(false) } + +func TestHelp_ActivitySubcommands(t *testing.T) { + h := NewCommandHarness(t) + + res := h.Execute("help", "activity") + assert.NoError(t, res.Err) + out := res.Stdout.String() + for _, sub := range []string{"cancel", "complete", "count", "delete", "describe", "execute", "fail", "list", "result", "start", "terminate"} { + assert.Contains(t, out, sub, "missing subcommand %q in activity help", sub) + } +} + +func TestHelp_ActivityStartFlags(t *testing.T) { + h := NewCommandHarness(t) + + res := h.Execute("activity", "start", "--help") + assert.NoError(t, res.Err) + out := res.Stdout.String() + for _, flag := range []string{"--activity-id", "--type", "--task-queue", "--schedule-to-close-timeout", "--start-to-close-timeout", "--input"} { + assert.Contains(t, out, flag, "missing flag %q in activity start help", flag) + } +} + +func TestHelp_ActivityCompleteFlags(t *testing.T) { + h := NewCommandHarness(t) + + res := h.Execute("activity", "complete", "--help") + assert.NoError(t, res.Err) + out := res.Stdout.String() + assert.Contains(t, out, "--activity-id") + assert.Contains(t, out, "--workflow-id") + assert.Contains(t, out, "--result") +} + +func TestHelp_ActivityFailFlags(t *testing.T) { + h := NewCommandHarness(t) + + res := h.Execute("activity", "fail", "--help") + assert.NoError(t, res.Err) + out := res.Stdout.String() + assert.Contains(t, out, "--activity-id") + assert.Contains(t, out, "--workflow-id") + assert.Contains(t, out, "--detail") + assert.Contains(t, out, "--reason") +} From 1b728de6ba18dabf955e36a344b70050498cd174 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 15 Feb 2026 21:32:08 -0500 Subject: [PATCH 08/30] Address code review feedback on activity command docs - Use 'activity complete' as the primary example instead of experimental 'activity start' command - Restore original description-header text for docs - Revert unnecessary commonpb import alias (use default 'common' since no conflict exists in this file) Co-Authored-By: Claude Opus 4.5 --- internal/temporalcli/commands.activity.go | 28 +++++++++++------------ internal/temporalcli/commands.gen.go | 4 ++-- internal/temporalcli/commands.yaml | 23 ++++++++++--------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/internal/temporalcli/commands.activity.go b/internal/temporalcli/commands.activity.go index bb15f1a1f..d30772f3d 100644 --- a/internal/temporalcli/commands.activity.go +++ b/internal/temporalcli/commands.activity.go @@ -8,7 +8,7 @@ import ( "github.com/temporalio/cli/internal/printer" activitypb "go.temporal.io/api/activity/v1" "go.temporal.io/api/batch/v1" - commonpb "go.temporal.io/api/common/v1" + "go.temporal.io/api/common/v1" enumspb "go.temporal.io/api/enums/v1" "go.temporal.io/api/failure/v1" sdkpb "go.temporal.io/api/sdk/v1" @@ -69,7 +69,7 @@ func (c *TemporalActivityFailCommand) run(cctx *CommandContext, args []string) e } defer cl.Close() - var detailPayloads *commonpb.Payloads + var detailPayloads *common.Payloads if len(c.Detail) > 0 { metadata := map[string][][]byte{"encoding": {[]byte("json/plain")}} detailPayloads, err = CreatePayloads([][]byte{[]byte(c.Detail)}, metadata, false) @@ -137,7 +137,7 @@ func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args [] c.Command.Flags().Changed("retry-maximum-interval") || c.Command.Flags().Changed("retry-backoff-coefficient") || c.Command.Flags().Changed("retry-maximum-attempts") { - activityOptions.RetryPolicy = &commonpb.RetryPolicy{} + activityOptions.RetryPolicy = &common.RetryPolicy{} } if c.Command.Flags().Changed("retry-initial-interval") { @@ -177,7 +177,7 @@ func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args [] if exec != nil { result, err := cl.WorkflowService().UpdateActivityOptions(cctx, &workflowservice.UpdateActivityOptionsRequest{ Namespace: c.Parent.Namespace, - Execution: &commonpb.WorkflowExecution{ + Execution: &common.WorkflowExecution{ WorkflowId: c.WorkflowId, RunId: c.RunId, }, @@ -245,7 +245,7 @@ func (c *TemporalActivityPauseCommand) run(cctx *CommandContext, args []string) request := &workflowservice.PauseActivityRequest{ Namespace: c.Parent.Namespace, - Execution: &commonpb.WorkflowExecution{ + Execution: &common.WorkflowExecution{ WorkflowId: c.WorkflowId, RunId: c.RunId, }, @@ -292,7 +292,7 @@ func (c *TemporalActivityUnpauseCommand) run(cctx *CommandContext, args []string if exec != nil { // single workflow operation request := &workflowservice.UnpauseActivityRequest{ Namespace: c.Parent.Namespace, - Execution: &commonpb.WorkflowExecution{ + Execution: &common.WorkflowExecution{ WorkflowId: c.WorkflowId, RunId: c.RunId, }, @@ -365,7 +365,7 @@ func (c *TemporalActivityResetCommand) run(cctx *CommandContext, args []string) if exec != nil { // single workflow operation request := &workflowservice.ResetActivityRequest{ Namespace: c.Parent.Namespace, - Execution: &commonpb.WorkflowExecution{ + Execution: &common.WorkflowExecution{ WorkflowId: c.WorkflowId, RunId: c.RunId, }, @@ -697,7 +697,7 @@ func buildStartActivityRequest( Identity: parent.Identity, RequestId: uuid.New().String(), ActivityId: opts.ActivityId, - ActivityType: &commonpb.ActivityType{ + ActivityType: &common.ActivityType{ Name: opts.Type, }, TaskQueue: &taskqueuepb.TaskQueue{ @@ -712,7 +712,7 @@ func buildStartActivityRequest( if opts.RetryInitialInterval.Duration() > 0 || opts.RetryMaximumInterval.Duration() > 0 || opts.RetryBackoffCoefficient > 0 || opts.RetryMaximumAttempts > 0 { - req.RetryPolicy = &commonpb.RetryPolicy{} + req.RetryPolicy = &common.RetryPolicy{} if opts.RetryInitialInterval.Duration() > 0 { req.RetryPolicy.InitialInterval = durationpb.New(opts.RetryInitialInterval.Duration()) } @@ -753,7 +753,7 @@ func buildStartActivityRequest( if err != nil { return nil, fmt.Errorf("failed encoding search attributes: %w", err) } - req.SearchAttributes = &commonpb.SearchAttributes{IndexedFields: saPayloads} + req.SearchAttributes = &common.SearchAttributes{IndexedFields: saPayloads} } if len(opts.Headers) > 0 { @@ -765,19 +765,19 @@ func buildStartActivityRequest( if err != nil { return nil, fmt.Errorf("failed encoding headers: %w", err) } - req.Header = &commonpb.Header{Fields: headerPayloads} + req.Header = &common.Header{Fields: headerPayloads} } if opts.StaticSummary != "" || opts.StaticDetails != "" { req.UserMetadata = &sdkpb.UserMetadata{} if opts.StaticSummary != "" { - req.UserMetadata.Summary = &commonpb.Payload{ + req.UserMetadata.Summary = &common.Payload{ Metadata: map[string][]byte{"encoding": []byte("json/plain")}, Data: []byte(fmt.Sprintf("%q", opts.StaticSummary)), } } if opts.StaticDetails != "" { - req.UserMetadata.Details = &commonpb.Payload{ + req.UserMetadata.Details = &common.Payload{ Metadata: map[string][]byte{"encoding": []byte("json/plain")}, Data: []byte(fmt.Sprintf("%q", opts.StaticDetails)), } @@ -785,7 +785,7 @@ func buildStartActivityRequest( } if opts.PriorityKey > 0 || opts.FairnessKey != "" || opts.FairnessWeight > 0 { - req.Priority = &commonpb.Priority{ + req.Priority = &common.Priority{ PriorityKey: int32(opts.PriorityKey), FairnessKey: opts.FairnessKey, FairnessWeight: float32(opts.FairnessWeight), diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 7cc59eb42..87836fb48 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -454,9 +454,9 @@ func NewTemporalActivityCommand(cctx *CommandContext, parent *TemporalCommand) * s.Command.Use = "activity" s.Command.Short = "Operate on Activity Executions" if hasHighlighting { - s.Command.Long = "Start, list, and manage Activity Executions.\n\nStart an Activity Execution (Experimental):\n\n\x1b[1mtemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m\n\nComplete an Activity manually:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --result '{\"YourResultKey\": \"YourResultValue\"}'\x1b[0m" + s.Command.Long = "Complete, fail, or update an Activity's state or options.\n\nComplete an Activity manually:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultValue\"}'\x1b[0m\n\nUpdate Activity options:\n\n\x1b[1mtemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueue\x1b[0m" } else { - s.Command.Long = "Start, list, and manage Activity Executions.\n\nStart an Activity Execution (Experimental):\n\n```\ntemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```\n\nComplete an Activity manually:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --result '{\"YourResultKey\": \"YourResultValue\"}'\n```" + s.Command.Long = "Complete, fail, or update an Activity's state or options.\n\nComplete an Activity manually:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultValue\"}'\n```\n\nUpdate Activity options:\n\n```\ntemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueue\n```" } s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalActivityCancelCommand(cctx, &s).Command) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index be846d1f4..734588664 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -148,31 +148,32 @@ commands: - name: temporal activity summary: Operate on Activity Executions description: | - Start, list, and manage Activity Executions. + Complete, fail, or update an Activity's state or options. - Start an Activity Execution (Experimental): + Complete an Activity manually: ``` - temporal activity start \ + temporal activity complete \ --activity-id YourActivityId \ - --type YourActivity \ - --task-queue YourTaskQueue \ - --input '{"some-key": "some-value"}' + --workflow-id YourWorkflowId \ + --result '{"YourResultKey": "YourResultValue"}' ``` - Complete an Activity manually: + Update Activity options: ``` - temporal activity complete \ + temporal activity update-options \ --activity-id YourActivityId \ - --result '{"YourResultKey": "YourResultValue"}' + --workflow-id YourWorkflowId \ + --task-queue NewTaskQueue ``` option-sets: - client docs: description-header: >- - Start, list, and manage Activity Executions - using the Temporal CLI. + Learn how to use Temporal Activity commands for completing or failing + Activity Executions in your Workflow. Optimize your Temporal Workflow + management effectively. keywords: - activity - activity start From 2ec455d0799306d2e7ca186e055c4bd41f1ef6da Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 15 Feb 2026 23:07:11 -0500 Subject: [PATCH 09/30] Address PR 942 review: docs and revert noise - Activity count/list/result: use Standalone Activity Execution wording and 'only supported for Standalone Activity Execution' - Activity complete/fail: restore --workflow-id YourWorkflowId in examples - Keywords: restore 'activity execution' - Activity count/list: Search Attributes and queries; filter/to be counted - Workflow execute: add backslash after execute in example - Workflow start: revert to main (Initiate, Returns Workflow- and Run-IDs) - Workflow delete: revert to main (Remove, Executions typo); remove TODO - Workflow result: remove TODO (output verb already used) - Workflow count/list: example query and remove TODOs; queries. wording - Restore trailing spaces in worker deployment and task-queue docs to avoid whitespace-only diff noise Co-authored-by: Cursor --- internal/temporalcli/commands.yaml | 74 +++++++++++++++--------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index 734588664..1026e8a7d 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -186,6 +186,7 @@ commands: - activity delete - activity complete - activity update-options + - activity execution - activity fail - activity pause - activity unpause @@ -231,6 +232,7 @@ commands: ``` temporal activity complete \ --activity-id YourActivityId \ + --workflow-id YourWorkflowId \ --result '{"YourResultKey": "YourResultVal"}' ``` option-sets: @@ -248,10 +250,12 @@ commands: required: true - name: temporal activity count - summary: Count Activity Executions (Experimental) + summary: Count Standalone Activity Executions (Experimental) description: | - Return a count of Activity Executions. Use `--query` to count - a subset: + Return a count of Standalone Activity Executions. Use `--query` to filter + the activities to be counted. + + Only supported for Standalone Activity Execution. ``` temporal activity count \ @@ -259,7 +263,7 @@ commands: ``` Visit https://docs.temporal.io/visibility to read more about - Search Attributes and Query creation. + Search Attributes and queries. options: - name: query type: string @@ -322,7 +326,8 @@ commands: ``` temporal activity fail \ - --activity-id YourActivityId + --activity-id YourActivityId \ + --workflow-id YourWorkflowId ``` option-sets: - activity-reference @@ -344,9 +349,11 @@ commands: Failure reason. Attached as the failure message. - name: temporal activity list - summary: Show Activity Executions (Experimental) + summary: List Standalone Activity Executions (Experimental) description: | - List Activity Executions. Use `--query` to filter results: + List Standalone Activity Executions. Use `--query` to filter results. + + Only supported for Standalone Activity Execution. ``` temporal activity list \ @@ -354,7 +361,7 @@ commands: ``` Visit https://docs.temporal.io/visibility to read more about - Search Attributes and Query creation. + Search Attributes and queries. options: - name: query short: q @@ -675,10 +682,12 @@ commands: - single-workflow-or-batch - name: temporal activity result - summary: Wait for and output the result of an Activity Execution (Experimental) + summary: Wait for and output the result of a Standalone Activity Execution (Experimental) description: | - Wait for an Activity Execution to complete and output the - result: + Wait for a Standalone Activity Execution to complete and output the + result. + + Only supported for Standalone Activity Execution. ``` temporal activity result \ @@ -1295,7 +1304,7 @@ commands: temporal worker deployment manager-identity [command] [options] ``` - When present, `ManagerIdentity` is the identity of the user that has the + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. @@ -1324,7 +1333,7 @@ commands: description: | Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - When present, `ManagerIdentity` is the identity of the user that has the + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. @@ -1347,8 +1356,8 @@ commands: --identity YourUserIdentity # optional, populated by CLI if not provided ``` - Sets the Manager Identity of the Deployment to the identity of the user making - this request. If you don't specifically pass an identity field, the CLI will + Sets the Manager Identity of the Deployment to the identity of the user making + this request. If you don't specifically pass an identity field, the CLI will generate your identity for you. For example: @@ -1380,7 +1389,7 @@ commands: description: | Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - When present, `ManagerIdentity` is the identity of the user that has the + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. @@ -2717,8 +2726,8 @@ commands: provided that they were assigned a Build ID. Note that task reachability status is deprecated in favor of Drainage Status - (ie. of a Drained or Draining Worker Deployment Version) and will be removed - in a future release. Also, determining task reachability incurs a non-trivial + (ie. of a Drained or Draining Worker Deployment Version) and will be removed + in a future release. Also, determining task reachability incurs a non-trivial computing cost. Task reachability states are reported per build ID. The state may be one of the @@ -3590,13 +3599,11 @@ commands: ``` temporal workflow count \ - --query YourQuery + --query 'WorkflowType="YourWorkflow"' ``` - TODO: show an example query - Visit https://docs.temporal.io/visibility to read more about Search Attributes - and Query creation. See `temporal batch --help` for a quick reference. + and queries. See `temporal batch --help` for a quick reference. options: - name: query type: string @@ -3604,9 +3611,9 @@ commands: description: Content for an SQL-like `QUERY` List Filter. - name: temporal workflow delete - summary: Delete Workflow Execution + summary: Remove Workflow Execution description: | - Delete a Workflow Execution and its Event History: + Delete a Workflow Executions and its Event History: ``` temporal workflow delete \ @@ -3618,9 +3625,6 @@ commands: Visit https://docs.temporal.io/visibility to read more about Search Attributes and Query creation. See `temporal batch --help` for a quick reference. - - TODO: does this actually operate on batches and accept a query? It's not documented here, and - I don't see the functionality in DeleteWorkflowExecution. option-sets: - single-workflow-or-batch @@ -3658,7 +3662,7 @@ commands: command blocks and returns when the Workflow Execution completes: ``` - temporal workflow execute + temporal workflow execute \ --workflow-id YourWorkflowId \ --type YourWorkflow \ --task-queue YourTaskQueue \ @@ -3710,13 +3714,11 @@ commands: ``` temporal workflow list \ - --query YourQuery + --query 'WorkflowType="YourWorkflow"' ``` - TODO: show an example query - Visit https://docs.temporal.io/visibility to read more about Search Attributes - and Query creation. See `temporal batch --help` for a quick reference. + and queries. See `temporal batch --help` for a quick reference. View a list of archived Workflow Executions: @@ -3948,8 +3950,6 @@ commands: - name: temporal workflow result summary: Wait for and output the result of a Workflow Execution description: | - TODO: Let's use 'output' as the verb in such situations, rather than 'print' or 'return'. - Wait for and output the result of a Workflow Execution: ``` @@ -4088,9 +4088,9 @@ commands: - workflow-reference - name: temporal workflow start - summary: Start a Workflow Execution + summary: Initiate a Workflow Execution description: | - Start a new Workflow Execution. Outputs the Workflow ID and Run ID: + Start a new Workflow Execution. Returns the Workflow- and Run-IDs: ``` temporal workflow start \ @@ -4925,7 +4925,7 @@ option-sets: Temporal workflow headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times to set multiple Temporal headers. - Note: These are workflow headers, not gRPC headers. + Note: These are workflow headers, not gRPC headers. - name: workflow-update-options options: From adc532941356e2c3446d9318a7cbd9b053c8f4d7 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 15 Feb 2026 23:22:34 -0500 Subject: [PATCH 10/30] Revert "Address PR 942 review: docs and revert noise" This reverts commit 2ec455d0799306d2e7ca186e055c4bd41f1ef6da. --- internal/temporalcli/commands.yaml | 74 +++++++++++++++--------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index 1026e8a7d..734588664 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -186,7 +186,6 @@ commands: - activity delete - activity complete - activity update-options - - activity execution - activity fail - activity pause - activity unpause @@ -232,7 +231,6 @@ commands: ``` temporal activity complete \ --activity-id YourActivityId \ - --workflow-id YourWorkflowId \ --result '{"YourResultKey": "YourResultVal"}' ``` option-sets: @@ -250,12 +248,10 @@ commands: required: true - name: temporal activity count - summary: Count Standalone Activity Executions (Experimental) + summary: Count Activity Executions (Experimental) description: | - Return a count of Standalone Activity Executions. Use `--query` to filter - the activities to be counted. - - Only supported for Standalone Activity Execution. + Return a count of Activity Executions. Use `--query` to count + a subset: ``` temporal activity count \ @@ -263,7 +259,7 @@ commands: ``` Visit https://docs.temporal.io/visibility to read more about - Search Attributes and queries. + Search Attributes and Query creation. options: - name: query type: string @@ -326,8 +322,7 @@ commands: ``` temporal activity fail \ - --activity-id YourActivityId \ - --workflow-id YourWorkflowId + --activity-id YourActivityId ``` option-sets: - activity-reference @@ -349,11 +344,9 @@ commands: Failure reason. Attached as the failure message. - name: temporal activity list - summary: List Standalone Activity Executions (Experimental) + summary: Show Activity Executions (Experimental) description: | - List Standalone Activity Executions. Use `--query` to filter results. - - Only supported for Standalone Activity Execution. + List Activity Executions. Use `--query` to filter results: ``` temporal activity list \ @@ -361,7 +354,7 @@ commands: ``` Visit https://docs.temporal.io/visibility to read more about - Search Attributes and queries. + Search Attributes and Query creation. options: - name: query short: q @@ -682,12 +675,10 @@ commands: - single-workflow-or-batch - name: temporal activity result - summary: Wait for and output the result of a Standalone Activity Execution (Experimental) + summary: Wait for and output the result of an Activity Execution (Experimental) description: | - Wait for a Standalone Activity Execution to complete and output the - result. - - Only supported for Standalone Activity Execution. + Wait for an Activity Execution to complete and output the + result: ``` temporal activity result \ @@ -1304,7 +1295,7 @@ commands: temporal worker deployment manager-identity [command] [options] ``` - When present, `ManagerIdentity` is the identity of the user that has the + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. @@ -1333,7 +1324,7 @@ commands: description: | Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - When present, `ManagerIdentity` is the identity of the user that has the + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. @@ -1356,8 +1347,8 @@ commands: --identity YourUserIdentity # optional, populated by CLI if not provided ``` - Sets the Manager Identity of the Deployment to the identity of the user making - this request. If you don't specifically pass an identity field, the CLI will + Sets the Manager Identity of the Deployment to the identity of the user making + this request. If you don't specifically pass an identity field, the CLI will generate your identity for you. For example: @@ -1389,7 +1380,7 @@ commands: description: | Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - When present, `ManagerIdentity` is the identity of the user that has the + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. @@ -2726,8 +2717,8 @@ commands: provided that they were assigned a Build ID. Note that task reachability status is deprecated in favor of Drainage Status - (ie. of a Drained or Draining Worker Deployment Version) and will be removed - in a future release. Also, determining task reachability incurs a non-trivial + (ie. of a Drained or Draining Worker Deployment Version) and will be removed + in a future release. Also, determining task reachability incurs a non-trivial computing cost. Task reachability states are reported per build ID. The state may be one of the @@ -3599,11 +3590,13 @@ commands: ``` temporal workflow count \ - --query 'WorkflowType="YourWorkflow"' + --query YourQuery ``` + TODO: show an example query + Visit https://docs.temporal.io/visibility to read more about Search Attributes - and queries. See `temporal batch --help` for a quick reference. + and Query creation. See `temporal batch --help` for a quick reference. options: - name: query type: string @@ -3611,9 +3604,9 @@ commands: description: Content for an SQL-like `QUERY` List Filter. - name: temporal workflow delete - summary: Remove Workflow Execution + summary: Delete Workflow Execution description: | - Delete a Workflow Executions and its Event History: + Delete a Workflow Execution and its Event History: ``` temporal workflow delete \ @@ -3625,6 +3618,9 @@ commands: Visit https://docs.temporal.io/visibility to read more about Search Attributes and Query creation. See `temporal batch --help` for a quick reference. + + TODO: does this actually operate on batches and accept a query? It's not documented here, and + I don't see the functionality in DeleteWorkflowExecution. option-sets: - single-workflow-or-batch @@ -3662,7 +3658,7 @@ commands: command blocks and returns when the Workflow Execution completes: ``` - temporal workflow execute \ + temporal workflow execute --workflow-id YourWorkflowId \ --type YourWorkflow \ --task-queue YourTaskQueue \ @@ -3714,11 +3710,13 @@ commands: ``` temporal workflow list \ - --query 'WorkflowType="YourWorkflow"' + --query YourQuery ``` + TODO: show an example query + Visit https://docs.temporal.io/visibility to read more about Search Attributes - and queries. See `temporal batch --help` for a quick reference. + and Query creation. See `temporal batch --help` for a quick reference. View a list of archived Workflow Executions: @@ -3950,6 +3948,8 @@ commands: - name: temporal workflow result summary: Wait for and output the result of a Workflow Execution description: | + TODO: Let's use 'output' as the verb in such situations, rather than 'print' or 'return'. + Wait for and output the result of a Workflow Execution: ``` @@ -4088,9 +4088,9 @@ commands: - workflow-reference - name: temporal workflow start - summary: Initiate a Workflow Execution + summary: Start a Workflow Execution description: | - Start a new Workflow Execution. Returns the Workflow- and Run-IDs: + Start a new Workflow Execution. Outputs the Workflow ID and Run ID: ``` temporal workflow start \ @@ -4925,7 +4925,7 @@ option-sets: Temporal workflow headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times to set multiple Temporal headers. - Note: These are workflow headers, not gRPC headers. + Note: These are workflow headers, not gRPC headers. - name: workflow-update-options options: From 2de6d1ed3a151e1323ef8fcfac4941d380ffbfee Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 15 Feb 2026 23:26:58 -0500 Subject: [PATCH 11/30] Address PR 942 review: standalone wording, examples, TODOs, reverts - Activity complete/fail: restore --workflow-id in examples - Activity count/list: Standalone Activity Execution wording, filter/sentences, Search Attributes and queries - All standalone-only activity commands: summary + only supported sentence - Restore activity execution keyword - Workflow describe: revert summary to Show Workflow Execution info - Workflow delete: remove TODO - Workflow terminate: revert summary to Forcefully end a Workflow Execution - Workflow execute: add backslash after execute in example - Workflow count/list: remove TODO show an example query - Workflow result: remove TODO Co-authored-by: Cursor --- internal/temporalcli/commands.yaml | 69 ++++++++++++++---------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index 734588664..f12e09b59 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -184,6 +184,7 @@ commands: - activity cancel - activity terminate - activity delete + - activity execution - activity complete - activity update-options - activity fail @@ -199,9 +200,9 @@ commands: - Temporal CLI - name: temporal activity cancel - summary: Request cancellation of an Activity Execution (Experimental) + summary: Request cancellation of a Standalone Activity Execution (Experimental) description: | - Request cancellation of an Activity Execution: + Request cancellation of a Standalone Activity Execution. Only supported for Standalone Activity Execution. ``` temporal activity cancel \ @@ -231,6 +232,7 @@ commands: ``` temporal activity complete \ --activity-id YourActivityId \ + --workflow-id YourWorkflowId \ --result '{"YourResultKey": "YourResultVal"}' ``` option-sets: @@ -248,10 +250,10 @@ commands: required: true - name: temporal activity count - summary: Count Activity Executions (Experimental) + summary: Count Standalone Activity Executions (Experimental) description: | - Return a count of Activity Executions. Use `--query` to count - a subset: + Return a count of Standalone Activity Executions. Use `--query` to filter + the activities to be counted. Only supported for Standalone Activity Execution. ``` temporal activity count \ @@ -259,7 +261,7 @@ commands: ``` Visit https://docs.temporal.io/visibility to read more about - Search Attributes and Query creation. + Search Attributes and queries. options: - name: query type: string @@ -268,9 +270,9 @@ commands: Query to filter Activity Executions to count. - name: temporal activity delete - summary: Delete an Activity Execution (Experimental) + summary: Delete a Standalone Activity Execution (Experimental) description: | - Delete an Activity Execution: + Delete a Standalone Activity Execution. Only supported for Standalone Activity Execution. ``` temporal activity delete \ @@ -283,9 +285,9 @@ commands: - activity-reference - name: temporal activity describe - summary: Describe Activity Execution (Experimental) + summary: Describe a Standalone Activity Execution (Experimental) description: | - Display information about an Activity Execution: + Display information about a Standalone Activity Execution. Only supported for Standalone Activity Execution. ``` temporal activity describe \ @@ -299,10 +301,10 @@ commands: description: Print properties without changing their format. - name: temporal activity execute - summary: Start an Activity Execution and wait for completion (Experimental) + summary: Start a Standalone Activity Execution and wait for completion (Experimental) description: | - Start a new Activity Execution and block until it completes. - The result is output to stdout: + Start a new Standalone Activity Execution and block until it completes. + The result is output to stdout. Only supported for Standalone Activity Execution. ``` temporal activity execute \ @@ -322,7 +324,8 @@ commands: ``` temporal activity fail \ - --activity-id YourActivityId + --activity-id YourActivityId \ + --workflow-id YourWorkflowId ``` option-sets: - activity-reference @@ -344,9 +347,10 @@ commands: Failure reason. Attached as the failure message. - name: temporal activity list - summary: Show Activity Executions (Experimental) + summary: List Standalone Activity Executions (Experimental) description: | - List Activity Executions. Use `--query` to filter results: + List Standalone Activity Executions. Use `--query` to filter results. + Only supported for Standalone Activity Execution. ``` temporal activity list \ @@ -354,7 +358,7 @@ commands: ``` Visit https://docs.temporal.io/visibility to read more about - Search Attributes and Query creation. + Search Attributes and queries. options: - name: query short: q @@ -675,10 +679,10 @@ commands: - single-workflow-or-batch - name: temporal activity result - summary: Wait for and output the result of an Activity Execution (Experimental) + summary: Wait for and output the result of a Standalone Activity Execution (Experimental) description: | - Wait for an Activity Execution to complete and output the - result: + Wait for a Standalone Activity Execution to complete and output the + result. Only supported for Standalone Activity Execution. ``` temporal activity result \ @@ -688,10 +692,10 @@ commands: - activity-reference - name: temporal activity start - summary: Start a new Activity Execution (Experimental) + summary: Start a new Standalone Activity Execution (Experimental) description: | - Start a new Activity Execution. Outputs the Activity ID and - Run ID: + Start a new Standalone Activity Execution. Outputs the Activity ID and + Run ID. Only supported for Standalone Activity Execution. ``` temporal activity start \ @@ -705,9 +709,9 @@ commands: - payload-input - name: temporal activity terminate - summary: Terminate an Activity Execution (Experimental) + summary: Terminate a Standalone Activity Execution (Experimental) description: | - Terminate an Activity Execution: + Terminate a Standalone Activity Execution. Only supported for Standalone Activity Execution. ``` temporal activity terminate \ @@ -3593,8 +3597,6 @@ commands: --query YourQuery ``` - TODO: show an example query - Visit https://docs.temporal.io/visibility to read more about Search Attributes and Query creation. See `temporal batch --help` for a quick reference. options: @@ -3618,14 +3620,11 @@ commands: Visit https://docs.temporal.io/visibility to read more about Search Attributes and Query creation. See `temporal batch --help` for a quick reference. - - TODO: does this actually operate on batches and accept a query? It's not documented here, and - I don't see the functionality in DeleteWorkflowExecution. option-sets: - single-workflow-or-batch - name: temporal workflow describe - summary: Describe Workflow Execution + summary: Show Workflow Execution info description: | Display information about a Workflow Execution: @@ -3658,7 +3657,7 @@ commands: command blocks and returns when the Workflow Execution completes: ``` - temporal workflow execute + temporal workflow execute \ --workflow-id YourWorkflowId \ --type YourWorkflow \ --task-queue YourTaskQueue \ @@ -3713,8 +3712,6 @@ commands: --query YourQuery ``` - TODO: show an example query - Visit https://docs.temporal.io/visibility to read more about Search Attributes and Query creation. See `temporal batch --help` for a quick reference. @@ -3948,8 +3945,6 @@ commands: - name: temporal workflow result summary: Wait for and output the result of a Workflow Execution description: | - TODO: Let's use 'output' as the verb in such situations, rather than 'print' or 'return'. - Wait for and output the result of a Workflow Execution: ``` @@ -4105,7 +4100,7 @@ commands: - payload-input - name: temporal workflow terminate - summary: Terminate a Workflow Execution + summary: Forcefully end a Workflow Execution description: | Terminate (forcefully end) a Workflow Execution: From c96bb91eaff68ea4881d078d2cb33b007fe03981 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 16 Feb 2026 00:06:10 -0500 Subject: [PATCH 12/30] Address remaining PR review: revert whitespace noise, apply suggestions - Revert all trailing-whitespace-only changes in deployment/worker sections - Restore trailing whitespace on workflow headers line to match main - Apply workflow start description suggestion (mention workflow execute) - Apply id-reuse-policy description suggestion - Apply id-conflict-policy description suggestion - Add visibility docs link to search-attribute description Co-authored-by: Cursor --- internal/temporalcli/commands.yaml | 56 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index f12e09b59..f74e76042 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -1298,17 +1298,17 @@ commands: ``` temporal worker deployment manager-identity [command] [options] ``` - - When present, `ManagerIdentity` is the identity of the user that has the + + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. - + This is especially useful in environments where multiple users (such as CLI users and automated controllers) may interact with the same Worker Deployment. `ManagerIdentity` allows different users to communicate with one another about who is expected to make changes to the Worker Deployment. - + The current Manager Identity is returned with `describe`: ``` temporal worker deployment describe \ @@ -1327,12 +1327,12 @@ commands: summary: Set the Manager Identity of a Worker Deployment description: | Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - - When present, `ManagerIdentity` is the identity of the user that has the + + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. - + This is especially useful in environments where multiple users (such as CLI users and automated controllers) may interact with the same Worker Deployment. `ManagerIdentity` allows different users to communicate with one another about @@ -1341,7 +1341,7 @@ commands: ``` temporal worker deployment manager-identity set [options] ``` - + For example: ``` @@ -1351,17 +1351,17 @@ commands: --identity YourUserIdentity # optional, populated by CLI if not provided ``` - Sets the Manager Identity of the Deployment to the identity of the user making - this request. If you don't specifically pass an identity field, the CLI will + Sets the Manager Identity of the Deployment to the identity of the user making + this request. If you don't specifically pass an identity field, the CLI will generate your identity for you. - + For example: ``` temporal worker deployment manager-identity set \ --deployment-name DeploymentName \ --manager-identity NewManagerIdentity ``` - + Sets the Manager Identity of the Deployment to any string. options: @@ -1383,12 +1383,12 @@ commands: summary: Unset the Manager Identity of a Worker Deployment description: | Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - - When present, `ManagerIdentity` is the identity of the user that has the + + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. - + This is especially useful in environments where multiple users (such as CLI users and automated controllers) may interact with the same Worker Deployment. `ManagerIdentity` allows different users to communicate with one another about @@ -1397,7 +1397,7 @@ commands: ``` temporal worker deployment manager-identity unset [options] ``` - + For example: ``` @@ -1420,7 +1420,7 @@ commands: summary: List worker status information in a specific namespace (EXPERIMENTAL) description: | Get a list of workers to the specified namespace. - + ``` temporal worker list --namespace YourNamespace --query 'TaskQueue="YourTaskQueue"' ``` @@ -1437,7 +1437,7 @@ commands: summary: Returns information about a specific worker (EXPERIMENTAL) description: | Look up information of a specific worker. - + ``` temporal worker describe --namespace YourNamespace --worker-instance-key YourKey ``` @@ -2721,8 +2721,8 @@ commands: provided that they were assigned a Build ID. Note that task reachability status is deprecated in favor of Drainage Status - (ie. of a Drained or Draining Worker Deployment Version) and will be removed - in a future release. Also, determining task reachability incurs a non-trivial + (ie. of a Drained or Draining Worker Deployment Version) and will be removed + in a future release. Also, determining task reachability incurs a non-trivial computing cost. Task reachability states are reported per build ID. The state may be one of the @@ -4085,7 +4085,9 @@ commands: - name: temporal workflow start summary: Start a Workflow Execution description: | - Start a new Workflow Execution. Outputs the Workflow ID and Run ID: + Start a new Workflow Execution without waiting for it to complete. + Use `temporal workflow execute` to start and wait for completion. + Outputs the Workflow ID and Run ID: ``` temporal workflow start \ @@ -4920,7 +4922,7 @@ option-sets: Temporal workflow headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times to set multiple Temporal headers. - Note: These are workflow headers, not gRPC headers. + Note: These are workflow headers, not gRPC headers. - name: workflow-update-options options: @@ -5018,8 +5020,8 @@ option-sets: - name: id-reuse-policy type: string-enum description: | - Re-use policy for the Activity ID when a previous - Execution has completed. + Policy for handling activity start when an Activity + with the same ID exists and has completed. enum-values: - AllowDuplicate - AllowDuplicateFailedOnly @@ -5027,9 +5029,8 @@ option-sets: - name: id-conflict-policy type: string-enum description: | - Policy for handling a conflict when starting an - Activity with a duplicate Activity ID of a running - Execution. + Policy for handling activity start when an + Activity with the same ID is currently running. enum-values: - Fail - UseExisting @@ -5040,6 +5041,7 @@ option-sets: Keys must be identifiers, and values must be JSON values. Can be passed multiple times. + See https://docs.temporal.io/visibility. - name: headers type: string[] description: | From c9f6af77bb70843e5c3f530ca36aeea493bbc5c6 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 16 Feb 2026 00:11:30 -0500 Subject: [PATCH 13/30] Remove examples from temporal activity top-level help Individual verb subcommands already have examples. Co-authored-by: Cursor --- internal/temporalcli/commands.yaml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index f74e76042..bc371d0bb 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -149,24 +149,6 @@ commands: summary: Operate on Activity Executions description: | Complete, fail, or update an Activity's state or options. - - Complete an Activity manually: - - ``` - temporal activity complete \ - --activity-id YourActivityId \ - --workflow-id YourWorkflowId \ - --result '{"YourResultKey": "YourResultValue"}' - ``` - - Update Activity options: - - ``` - temporal activity update-options \ - --activity-id YourActivityId \ - --workflow-id YourWorkflowId \ - --task-queue NewTaskQueue - ``` option-sets: - client docs: From ed5405afe77d9b8f2d49b800c0473e0dc79bdc05 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 16 Feb 2026 00:16:18 -0500 Subject: [PATCH 14/30] Remove redundant "Only supported for Standalone Activity Execution" The summaries already say "Standalone", making this sentence redundant in the descriptions. Co-authored-by: Cursor --- internal/temporalcli/commands.yaml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index bc371d0bb..fcd8eb3cf 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -184,7 +184,7 @@ commands: - name: temporal activity cancel summary: Request cancellation of a Standalone Activity Execution (Experimental) description: | - Request cancellation of a Standalone Activity Execution. Only supported for Standalone Activity Execution. + Request cancellation of a Standalone Activity Execution. ``` temporal activity cancel \ @@ -235,7 +235,7 @@ commands: summary: Count Standalone Activity Executions (Experimental) description: | Return a count of Standalone Activity Executions. Use `--query` to filter - the activities to be counted. Only supported for Standalone Activity Execution. + the activities to be counted. ``` temporal activity count \ @@ -254,7 +254,7 @@ commands: - name: temporal activity delete summary: Delete a Standalone Activity Execution (Experimental) description: | - Delete a Standalone Activity Execution. Only supported for Standalone Activity Execution. + Delete a Standalone Activity Execution. ``` temporal activity delete \ @@ -269,7 +269,7 @@ commands: - name: temporal activity describe summary: Describe a Standalone Activity Execution (Experimental) description: | - Display information about a Standalone Activity Execution. Only supported for Standalone Activity Execution. + Display information about a Standalone Activity Execution. ``` temporal activity describe \ @@ -286,7 +286,7 @@ commands: summary: Start a Standalone Activity Execution and wait for completion (Experimental) description: | Start a new Standalone Activity Execution and block until it completes. - The result is output to stdout. Only supported for Standalone Activity Execution. + The result is output to stdout. ``` temporal activity execute \ @@ -332,7 +332,6 @@ commands: summary: List Standalone Activity Executions (Experimental) description: | List Standalone Activity Executions. Use `--query` to filter results. - Only supported for Standalone Activity Execution. ``` temporal activity list \ @@ -664,7 +663,7 @@ commands: summary: Wait for and output the result of a Standalone Activity Execution (Experimental) description: | Wait for a Standalone Activity Execution to complete and output the - result. Only supported for Standalone Activity Execution. + result. ``` temporal activity result \ @@ -677,7 +676,7 @@ commands: summary: Start a new Standalone Activity Execution (Experimental) description: | Start a new Standalone Activity Execution. Outputs the Activity ID and - Run ID. Only supported for Standalone Activity Execution. + Run ID. ``` temporal activity start \ @@ -693,7 +692,7 @@ commands: - name: temporal activity terminate summary: Terminate a Standalone Activity Execution (Experimental) description: | - Terminate a Standalone Activity Execution. Only supported for Standalone Activity Execution. + Terminate a Standalone Activity Execution. ``` temporal activity terminate \ From 69f833549e5549d7ee9caadbd7aae5101a2b500c Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 16 Feb 2026 00:17:44 -0500 Subject: [PATCH 15/30] Capitalize "Standalone Activities" consistently Co-authored-by: Cursor --- internal/temporalcli/commands.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index fcd8eb3cf..804a959fd 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -225,7 +225,7 @@ commands: short: w description: | Workflow ID. Required for workflow Activities. - Omit for standalone Activities. + Omit for Standalone Activities. - name: result type: string description: Result `JSON` to return. @@ -317,7 +317,7 @@ commands: short: w description: | Workflow ID. Required for workflow Activities. - Omit for standalone Activities. + Omit for Standalone Activities. - name: detail type: string description: | @@ -361,7 +361,7 @@ commands: description: | Update the options of a running Activity that were passed into it from a Workflow. Updates are incremental, only changing the specified options. - Not supported for standalone Activities. + Not supported for Standalone Activities. For example: @@ -467,7 +467,7 @@ commands: - name: temporal activity pause summary: Pause an Activity description: | - Pause an Activity. Not supported for standalone Activities. + Pause an Activity. Not supported for Standalone Activities. If the Activity is not currently running (e.g. because it previously failed), it will not be run again until it is unpaused. @@ -510,7 +510,7 @@ commands: summary: Unpause an Activity description: | Re-schedule a previously-paused Activity for execution. - Not supported for standalone Activities. + Not supported for Standalone Activities. If the Activity is not running and is past its retry timeout, it will be scheduled immediately. Otherwise, it will be scheduled after its retry @@ -576,7 +576,7 @@ commands: - name: temporal activity reset summary: Reset an Activity description: | - Reset an activity. Not supported for standalone Activities. + Reset an activity. Not supported for Standalone Activities. This restarts the activity as if it were first being scheduled. That is, it will reset both the number of attempts and the activity timeout, as well as, optionally, the From a2ed393281d03580c8b5b48d4d0f9afc131a9c60 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 18 Feb 2026 17:02:05 -0500 Subject: [PATCH 16/30] Regenerate --- internal/temporalcli/commands.gen.go | 138 +++++++++++++-------------- 1 file changed, 67 insertions(+), 71 deletions(-) diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 87836fb48..bb063ff65 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -400,10 +400,10 @@ func (v *ActivityStartOptions) BuildFlags(f *pflag.FlagSet) { f.Float32Var(&v.RetryBackoffCoefficient, "retry-backoff-coefficient", 0, "Coefficient for calculating the next retry interval. Must be 1 or larger.") f.IntVar(&v.RetryMaximumAttempts, "retry-maximum-attempts", 0, "Maximum number of attempts. Setting to 1 disables retries. Setting to 0 means unlimited attempts.") v.IdReusePolicy = cliext.NewFlagStringEnum([]string{"AllowDuplicate", "AllowDuplicateFailedOnly", "RejectDuplicate"}, "") - f.Var(&v.IdReusePolicy, "id-reuse-policy", "Re-use policy for the Activity ID when a previous Execution has completed. Accepted values: AllowDuplicate, AllowDuplicateFailedOnly, RejectDuplicate.") + f.Var(&v.IdReusePolicy, "id-reuse-policy", "Policy for handling activity start when an Activity with the same ID exists and has completed. Accepted values: AllowDuplicate, AllowDuplicateFailedOnly, RejectDuplicate.") v.IdConflictPolicy = cliext.NewFlagStringEnum([]string{"Fail", "UseExisting"}, "") - f.Var(&v.IdConflictPolicy, "id-conflict-policy", "Policy for handling a conflict when starting an Activity with a duplicate Activity ID of a running Execution. Accepted values: Fail, UseExisting.") - f.StringArrayVar(&v.SearchAttribute, "search-attribute", nil, "Search Attribute in `KEY=VALUE` format. Keys must be identifiers, and values must be JSON values. Can be passed multiple times.") + f.Var(&v.IdConflictPolicy, "id-conflict-policy", "Policy for handling activity start when an Activity with the same ID is currently running. Accepted values: Fail, UseExisting.") + f.StringArrayVar(&v.SearchAttribute, "search-attribute", nil, "Search Attribute in `KEY=VALUE` format. Keys must be identifiers, and values must be JSON values. Can be passed multiple times. See https://docs.temporal.io/visibility.") f.StringArrayVar(&v.Headers, "headers", nil, "Temporal activity headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times.") f.StringVar(&v.StaticSummary, "static-summary", "", "Static Activity summary for human consumption in UIs. Uses Temporal Markdown formatting. EXPERIMENTAL.") f.StringVar(&v.StaticDetails, "static-details", "", "Static Activity details for human consumption in UIs. Uses Temporal Markdown formatting. EXPERIMENTAL.") @@ -453,11 +453,7 @@ func NewTemporalActivityCommand(cctx *CommandContext, parent *TemporalCommand) * s.Parent = parent s.Command.Use = "activity" s.Command.Short = "Operate on Activity Executions" - if hasHighlighting { - s.Command.Long = "Complete, fail, or update an Activity's state or options.\n\nComplete an Activity manually:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultValue\"}'\x1b[0m\n\nUpdate Activity options:\n\n\x1b[1mtemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueue\x1b[0m" - } else { - s.Command.Long = "Complete, fail, or update an Activity's state or options.\n\nComplete an Activity manually:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultValue\"}'\n```\n\nUpdate Activity options:\n\n```\ntemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueue\n```" - } + s.Command.Long = "Complete, fail, or update an Activity's state or options." s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalActivityCancelCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityCompleteCommand(cctx, &s).Command) @@ -490,11 +486,11 @@ func NewTemporalActivityCancelCommand(cctx *CommandContext, parent *TemporalActi s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "cancel [flags]" - s.Command.Short = "Request cancellation of an Activity Execution (Experimental)" + s.Command.Short = "Request cancellation of a Standalone Activity Execution (Experimental)" if hasHighlighting { - s.Command.Long = "Request cancellation of an Activity Execution:\n\n\x1b[1mtemporal activity cancel \\\n --activity-id YourActivityId\x1b[0m\n\nRequesting cancellation does not immediately cancel the\nActivity. If the Activity is heartbeating, a cancellation\nerror will be raised when the next heartbeat response is\nreceived; if the Activity allows this error to propagate, the\nActivity transitions to canceled status. If the Activity is\nnot heartbeating, this request has no effect on the Activity." + s.Command.Long = "Request cancellation of a Standalone Activity Execution.\n\n\x1b[1mtemporal activity cancel \\\n --activity-id YourActivityId\x1b[0m\n\nRequesting cancellation does not immediately cancel the\nActivity. If the Activity is heartbeating, a cancellation\nerror will be raised when the next heartbeat response is\nreceived; if the Activity allows this error to propagate, the\nActivity transitions to canceled status. If the Activity is\nnot heartbeating, this request has no effect on the Activity." } else { - s.Command.Long = "Request cancellation of an Activity Execution:\n\n```\ntemporal activity cancel \\\n --activity-id YourActivityId\n```\n\nRequesting cancellation does not immediately cancel the\nActivity. If the Activity is heartbeating, a cancellation\nerror will be raised when the next heartbeat response is\nreceived; if the Activity allows this error to propagate, the\nActivity transitions to canceled status. If the Activity is\nnot heartbeating, this request has no effect on the Activity." + s.Command.Long = "Request cancellation of a Standalone Activity Execution.\n\n```\ntemporal activity cancel \\\n --activity-id YourActivityId\n```\n\nRequesting cancellation does not immediately cancel the\nActivity. If the Activity is heartbeating, a cancellation\nerror will be raised when the next heartbeat response is\nreceived; if the Activity allows this error to propagate, the\nActivity transitions to canceled status. If the Activity is\nnot heartbeating, this request has no effect on the Activity." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.Reason, "reason", "", "Reason for cancellation.") @@ -522,12 +518,12 @@ func NewTemporalActivityCompleteCommand(cctx *CommandContext, parent *TemporalAc s.Command.Use = "complete [flags]" s.Command.Short = "Complete an Activity" if hasHighlighting { - s.Command.Long = "Complete an Activity, marking it as successfully finished.\nSpecify the Activity ID and include a JSON result for the\nreturned value:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\x1b[0m" + s.Command.Long = "Complete an Activity, marking it as successfully finished.\nSpecify the Activity ID and include a JSON result for the\nreturned value:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\x1b[0m" } else { - s.Command.Long = "Complete an Activity, marking it as successfully finished.\nSpecify the Activity ID and include a JSON result for the\nreturned value:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\n```" + s.Command.Long = "Complete an Activity, marking it as successfully finished.\nSpecify the Activity ID and include a JSON result for the\nreturned value:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\n```" } s.Command.Args = cobra.NoArgs - s.Command.Flags().StringVarP(&s.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required for workflow Activities. Omit for standalone Activities.") + s.Command.Flags().StringVarP(&s.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required for workflow Activities. Omit for Standalone Activities.") s.Command.Flags().StringVar(&s.Result, "result", "", "Result `JSON` to return. Required.") _ = cobra.MarkFlagRequired(s.Command.Flags(), "result") s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) @@ -550,11 +546,11 @@ func NewTemporalActivityCountCommand(cctx *CommandContext, parent *TemporalActiv s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "count [flags]" - s.Command.Short = "Count Activity Executions (Experimental)" + s.Command.Short = "Count Standalone Activity Executions (Experimental)" if hasHighlighting { - s.Command.Long = "Return a count of Activity Executions. Use \x1b[1m--query\x1b[0m to count\na subset:\n\n\x1b[1mtemporal activity count \\\n --query 'ActivityType=\"YourActivity\"'\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and Query creation." + s.Command.Long = "Return a count of Standalone Activity Executions. Use \x1b[1m--query\x1b[0m to filter\nthe activities to be counted.\n\n\x1b[1mtemporal activity count \\\n --query 'ActivityType=\"YourActivity\"'\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and queries." } else { - s.Command.Long = "Return a count of Activity Executions. Use `--query` to count\na subset:\n\n```\ntemporal activity count \\\n --query 'ActivityType=\"YourActivity\"'\n```\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and Query creation." + s.Command.Long = "Return a count of Standalone Activity Executions. Use `--query` to filter\nthe activities to be counted.\n\n```\ntemporal activity count \\\n --query 'ActivityType=\"YourActivity\"'\n```\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and queries." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Query to filter Activity Executions to count.") @@ -577,11 +573,11 @@ func NewTemporalActivityDeleteCommand(cctx *CommandContext, parent *TemporalActi s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "delete [flags]" - s.Command.Short = "Delete an Activity Execution (Experimental)" + s.Command.Short = "Delete a Standalone Activity Execution (Experimental)" if hasHighlighting { - s.Command.Long = "Delete an Activity Execution:\n\n\x1b[1mtemporal activity delete \\\n --activity-id YourActivityId\x1b[0m\n\nThe deletion executes asynchronously. If the Activity\nExecution is running, it will be terminated before deletion." + s.Command.Long = "Delete a Standalone Activity Execution.\n\n\x1b[1mtemporal activity delete \\\n --activity-id YourActivityId\x1b[0m\n\nThe deletion executes asynchronously. If the Activity\nExecution is running, it will be terminated before deletion." } else { - s.Command.Long = "Delete an Activity Execution:\n\n```\ntemporal activity delete \\\n --activity-id YourActivityId\n```\n\nThe deletion executes asynchronously. If the Activity\nExecution is running, it will be terminated before deletion." + s.Command.Long = "Delete a Standalone Activity Execution.\n\n```\ntemporal activity delete \\\n --activity-id YourActivityId\n```\n\nThe deletion executes asynchronously. If the Activity\nExecution is running, it will be terminated before deletion." } s.Command.Args = cobra.NoArgs s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) @@ -605,11 +601,11 @@ func NewTemporalActivityDescribeCommand(cctx *CommandContext, parent *TemporalAc s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "describe [flags]" - s.Command.Short = "Describe Activity Execution (Experimental)" + s.Command.Short = "Describe a Standalone Activity Execution (Experimental)" if hasHighlighting { - s.Command.Long = "Display information about an Activity Execution:\n\n\x1b[1mtemporal activity describe \\\n --activity-id YourActivityId\x1b[0m" + s.Command.Long = "Display information about a Standalone Activity Execution.\n\n\x1b[1mtemporal activity describe \\\n --activity-id YourActivityId\x1b[0m" } else { - s.Command.Long = "Display information about an Activity Execution:\n\n```\ntemporal activity describe \\\n --activity-id YourActivityId\n```" + s.Command.Long = "Display information about a Standalone Activity Execution.\n\n```\ntemporal activity describe \\\n --activity-id YourActivityId\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().BoolVar(&s.Raw, "raw", false, "Print properties without changing their format.") @@ -634,11 +630,11 @@ func NewTemporalActivityExecuteCommand(cctx *CommandContext, parent *TemporalAct s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "execute [flags]" - s.Command.Short = "Start an Activity Execution and wait for completion (Experimental)" + s.Command.Short = "Start a Standalone Activity Execution and wait for completion (Experimental)" if hasHighlighting { - s.Command.Long = "Start a new Activity Execution and block until it completes.\nThe result is output to stdout:\n\n\x1b[1mtemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" + s.Command.Long = "Start a new Standalone Activity Execution and block until it completes.\nThe result is output to stdout.\n\n\x1b[1mtemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" } else { - s.Command.Long = "Start a new Activity Execution and block until it completes.\nThe result is output to stdout:\n\n```\ntemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" + s.Command.Long = "Start a new Standalone Activity Execution and block until it completes.\nThe result is output to stdout.\n\n```\ntemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" } s.Command.Args = cobra.NoArgs s.ActivityStartOptions.BuildFlags(s.Command.Flags()) @@ -667,12 +663,12 @@ func NewTemporalActivityFailCommand(cctx *CommandContext, parent *TemporalActivi s.Command.Use = "fail [flags]" s.Command.Short = "Fail an Activity" if hasHighlighting { - s.Command.Long = "Fail an Activity, marking it as having encountered an error:\n\n\x1b[1mtemporal activity fail \\\n --activity-id YourActivityId\x1b[0m" + s.Command.Long = "Fail an Activity, marking it as having encountered an error:\n\n\x1b[1mtemporal activity fail \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\x1b[0m" } else { - s.Command.Long = "Fail an Activity, marking it as having encountered an error:\n\n```\ntemporal activity fail \\\n --activity-id YourActivityId\n```" + s.Command.Long = "Fail an Activity, marking it as having encountered an error:\n\n```\ntemporal activity fail \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n```" } s.Command.Args = cobra.NoArgs - s.Command.Flags().StringVarP(&s.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required for workflow Activities. Omit for standalone Activities.") + s.Command.Flags().StringVarP(&s.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required for workflow Activities. Omit for Standalone Activities.") s.Command.Flags().StringVar(&s.Detail, "detail", "", "Failure detail (JSON). Attached as the failure details payload.") s.Command.Flags().StringVar(&s.Reason, "reason", "", "Failure reason. Attached as the failure message.") s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) @@ -697,11 +693,11 @@ func NewTemporalActivityListCommand(cctx *CommandContext, parent *TemporalActivi s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "list [flags]" - s.Command.Short = "Show Activity Executions (Experimental)" + s.Command.Short = "List Standalone Activity Executions (Experimental)" if hasHighlighting { - s.Command.Long = "List Activity Executions. Use \x1b[1m--query\x1b[0m to filter results:\n\n\x1b[1mtemporal activity list \\\n --query 'ActivityType=\"YourActivity\"'\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and Query creation." + s.Command.Long = "List Standalone Activity Executions. Use \x1b[1m--query\x1b[0m to filter results.\n\n\x1b[1mtemporal activity list \\\n --query 'ActivityType=\"YourActivity\"'\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and queries." } else { - s.Command.Long = "List Activity Executions. Use `--query` to filter results:\n\n```\ntemporal activity list \\\n --query 'ActivityType=\"YourActivity\"'\n```\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and Query creation." + s.Command.Long = "List Standalone Activity Executions. Use `--query` to filter results.\n\n```\ntemporal activity list \\\n --query 'ActivityType=\"YourActivity\"'\n```\n\nVisit https://docs.temporal.io/visibility to read more about\nSearch Attributes and queries." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Query to filter the Activity Executions to list.") @@ -731,9 +727,9 @@ func NewTemporalActivityPauseCommand(cctx *CommandContext, parent *TemporalActiv s.Command.Use = "pause [flags]" s.Command.Short = "Pause an Activity" if hasHighlighting { - s.Command.Long = "Pause an Activity. Not supported for standalone Activities.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run until the next\ntime it fails, completes, or times out, at which point the pause will kick in.\n\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nActivities should be specified either by their Activity ID or Activity Type.\n\nFor example, specify the Activity and Workflow IDs like this:\n\n\x1b[1mtemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\x1b[0m\n\nTo later unpause the activity, see unpause. You may also want to\nreset the activity to unpause it while also starting it from the beginning." + s.Command.Long = "Pause an Activity. Not supported for Standalone Activities.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run until the next\ntime it fails, completes, or times out, at which point the pause will kick in.\n\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nActivities should be specified either by their Activity ID or Activity Type.\n\nFor example, specify the Activity and Workflow IDs like this:\n\n\x1b[1mtemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\x1b[0m\n\nTo later unpause the activity, see unpause. You may also want to\nreset the activity to unpause it while also starting it from the beginning." } else { - s.Command.Long = "Pause an Activity. Not supported for standalone Activities.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run until the next\ntime it fails, completes, or times out, at which point the pause will kick in.\n\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nActivities should be specified either by their Activity ID or Activity Type.\n\nFor example, specify the Activity and Workflow IDs like this:\n\n```\ntemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n```\n\nTo later unpause the activity, see unpause. You may also want to\nreset the activity to unpause it while also starting it from the beginning." + s.Command.Long = "Pause an Activity. Not supported for Standalone Activities.\n\nIf the Activity is not currently running (e.g. because it previously\nfailed), it will not be run again until it is unpaused.\n\nHowever, if the Activity is currently running, it will run until the next\ntime it fails, completes, or times out, at which point the pause will kick in.\n\nIf the Activity is on its last retry attempt and fails, the failure will\nbe returned to the caller, just as if the Activity had not been paused.\n\nActivities should be specified either by their Activity ID or Activity Type.\n\nFor example, specify the Activity and Workflow IDs like this:\n\n```\ntemporal activity pause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n```\n\nTo later unpause the activity, see unpause. You may also want to\nreset the activity to unpause it while also starting it from the beginning." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "The Activity ID to pause. Either `activity-id` or `activity-type` must be provided, but not both.") @@ -769,9 +765,9 @@ func NewTemporalActivityResetCommand(cctx *CommandContext, parent *TemporalActiv s.Command.Use = "reset [flags]" s.Command.Short = "Reset an Activity" if hasHighlighting { - s.Command.Long = "Reset an activity. Not supported for standalone Activities.\nThis restarts the activity as if it were first being\nscheduled. That is, it will reset both the number of attempts and the\nactivity timeout, as well as, optionally, the\nheartbeat details.\n\nIf the activity may be executing (i.e. it has not yet timed out), the\nreset will take effect the next time it fails, heartbeats, or times out.\nIf is waiting for a retry (i.e. has failed or timed out), the reset\nwill apply immediately.\n\nIf the activity is already paused, it will be unpaused by default.\nYou can specify \x1b[1mkeep_paused\x1b[0m to prevent this.\n\nIf the activity is paused and the \x1b[1mkeep_paused\x1b[0m flag is not provided,\nit will be unpaused. If the activity is paused and \x1b[1mkeep_paused\x1b[0m flag\nis provided - it will stay paused.\n\nActivities can be specified by their Activity ID or Activity Type.\n\n### Resetting activities that heartbeat {#reset-heartbeats}\n\nActivities that heartbeat will receive a Canceled failure\nthe next time they heartbeat after a reset.\n\nIf, in your Activity, you need to do any cleanup when an Activity is\nreset, handle this error and then re-throw it when you've cleaned up.\n\nIf the \x1b[1mreset_heartbeats\x1b[0m flag is set, the heartbeat details will also be cleared.\n\nSpecify the Activity Type of ID and Workflow IDs:\n\n\x1b[1mtemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --keep-paused\n --reset-heartbeats\x1b[0m\n\nEither \x1b[1mactivity-id\x1b[0m, \x1b[1mactivity-type\x1b[0m, or \x1b[1m--match-all\x1b[0m must be specified.\n\nActivities can be reset in bulk with a visibility query list filter.\nFor example, if you want to reset activities of type Foo:\n\n\x1b[1mtemporal activity reset \\\n --query 'TemporalResetInfo=\"property:activityType=Foo\"'\x1b[0m" + s.Command.Long = "Reset an activity. Not supported for Standalone Activities.\nThis restarts the activity as if it were first being\nscheduled. That is, it will reset both the number of attempts and the\nactivity timeout, as well as, optionally, the\nheartbeat details.\n\nIf the activity may be executing (i.e. it has not yet timed out), the\nreset will take effect the next time it fails, heartbeats, or times out.\nIf is waiting for a retry (i.e. has failed or timed out), the reset\nwill apply immediately.\n\nIf the activity is already paused, it will be unpaused by default.\nYou can specify \x1b[1mkeep_paused\x1b[0m to prevent this.\n\nIf the activity is paused and the \x1b[1mkeep_paused\x1b[0m flag is not provided,\nit will be unpaused. If the activity is paused and \x1b[1mkeep_paused\x1b[0m flag\nis provided - it will stay paused.\n\nActivities can be specified by their Activity ID or Activity Type.\n\n### Resetting activities that heartbeat {#reset-heartbeats}\n\nActivities that heartbeat will receive a Canceled failure\nthe next time they heartbeat after a reset.\n\nIf, in your Activity, you need to do any cleanup when an Activity is\nreset, handle this error and then re-throw it when you've cleaned up.\n\nIf the \x1b[1mreset_heartbeats\x1b[0m flag is set, the heartbeat details will also be cleared.\n\nSpecify the Activity Type of ID and Workflow IDs:\n\n\x1b[1mtemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --keep-paused\n --reset-heartbeats\x1b[0m\n\nEither \x1b[1mactivity-id\x1b[0m, \x1b[1mactivity-type\x1b[0m, or \x1b[1m--match-all\x1b[0m must be specified.\n\nActivities can be reset in bulk with a visibility query list filter.\nFor example, if you want to reset activities of type Foo:\n\n\x1b[1mtemporal activity reset \\\n --query 'TemporalResetInfo=\"property:activityType=Foo\"'\x1b[0m" } else { - s.Command.Long = "Reset an activity. Not supported for standalone Activities.\nThis restarts the activity as if it were first being\nscheduled. That is, it will reset both the number of attempts and the\nactivity timeout, as well as, optionally, the\nheartbeat details.\n\nIf the activity may be executing (i.e. it has not yet timed out), the\nreset will take effect the next time it fails, heartbeats, or times out.\nIf is waiting for a retry (i.e. has failed or timed out), the reset\nwill apply immediately.\n\nIf the activity is already paused, it will be unpaused by default.\nYou can specify `keep_paused` to prevent this.\n\nIf the activity is paused and the `keep_paused` flag is not provided,\nit will be unpaused. If the activity is paused and `keep_paused` flag\nis provided - it will stay paused.\n\nActivities can be specified by their Activity ID or Activity Type.\n\n### Resetting activities that heartbeat {#reset-heartbeats}\n\nActivities that heartbeat will receive a Canceled failure\nthe next time they heartbeat after a reset.\n\nIf, in your Activity, you need to do any cleanup when an Activity is\nreset, handle this error and then re-throw it when you've cleaned up.\n\nIf the `reset_heartbeats` flag is set, the heartbeat details will also be cleared.\n\nSpecify the Activity Type of ID and Workflow IDs:\n\n```\ntemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --keep-paused\n --reset-heartbeats\n```\n\nEither `activity-id`, `activity-type`, or `--match-all` must be specified.\n\nActivities can be reset in bulk with a visibility query list filter.\nFor example, if you want to reset activities of type Foo:\n\n```\ntemporal activity reset \\\n --query 'TemporalResetInfo=\"property:activityType=Foo\"'\n```" + s.Command.Long = "Reset an activity. Not supported for Standalone Activities.\nThis restarts the activity as if it were first being\nscheduled. That is, it will reset both the number of attempts and the\nactivity timeout, as well as, optionally, the\nheartbeat details.\n\nIf the activity may be executing (i.e. it has not yet timed out), the\nreset will take effect the next time it fails, heartbeats, or times out.\nIf is waiting for a retry (i.e. has failed or timed out), the reset\nwill apply immediately.\n\nIf the activity is already paused, it will be unpaused by default.\nYou can specify `keep_paused` to prevent this.\n\nIf the activity is paused and the `keep_paused` flag is not provided,\nit will be unpaused. If the activity is paused and `keep_paused` flag\nis provided - it will stay paused.\n\nActivities can be specified by their Activity ID or Activity Type.\n\n### Resetting activities that heartbeat {#reset-heartbeats}\n\nActivities that heartbeat will receive a Canceled failure\nthe next time they heartbeat after a reset.\n\nIf, in your Activity, you need to do any cleanup when an Activity is\nreset, handle this error and then re-throw it when you've cleaned up.\n\nIf the `reset_heartbeats` flag is set, the heartbeat details will also be cleared.\n\nSpecify the Activity Type of ID and Workflow IDs:\n\n```\ntemporal activity reset \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --keep-paused\n --reset-heartbeats\n```\n\nEither `activity-id`, `activity-type`, or `--match-all` must be specified.\n\nActivities can be reset in bulk with a visibility query list filter.\nFor example, if you want to reset activities of type Foo:\n\n```\ntemporal activity reset \\\n --query 'TemporalResetInfo=\"property:activityType=Foo\"'\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "The Activity ID to reset. Mutually exclusive with `--query`, `--match-all`, and `--activity-type`. Requires `--workflow-id` to be specified.") @@ -803,11 +799,11 @@ func NewTemporalActivityResultCommand(cctx *CommandContext, parent *TemporalActi s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "result [flags]" - s.Command.Short = "Wait for and output the result of an Activity Execution (Experimental)" + s.Command.Short = "Wait for and output the result of a Standalone Activity Execution (Experimental)" if hasHighlighting { - s.Command.Long = "Wait for an Activity Execution to complete and output the\nresult:\n\n\x1b[1mtemporal activity result \\\n --activity-id YourActivityId\x1b[0m" + s.Command.Long = "Wait for a Standalone Activity Execution to complete and output the\nresult.\n\n\x1b[1mtemporal activity result \\\n --activity-id YourActivityId\x1b[0m" } else { - s.Command.Long = "Wait for an Activity Execution to complete and output the\nresult:\n\n```\ntemporal activity result \\\n --activity-id YourActivityId\n```" + s.Command.Long = "Wait for a Standalone Activity Execution to complete and output the\nresult.\n\n```\ntemporal activity result \\\n --activity-id YourActivityId\n```" } s.Command.Args = cobra.NoArgs s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) @@ -831,11 +827,11 @@ func NewTemporalActivityStartCommand(cctx *CommandContext, parent *TemporalActiv s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "start [flags]" - s.Command.Short = "Start a new Activity Execution (Experimental)" + s.Command.Short = "Start a new Standalone Activity Execution (Experimental)" if hasHighlighting { - s.Command.Long = "Start a new Activity Execution. Outputs the Activity ID and\nRun ID:\n\n\x1b[1mtemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" + s.Command.Long = "Start a new Standalone Activity Execution. Outputs the Activity ID and\nRun ID.\n\n\x1b[1mtemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" } else { - s.Command.Long = "Start a new Activity Execution. Outputs the Activity ID and\nRun ID:\n\n```\ntemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" + s.Command.Long = "Start a new Standalone Activity Execution. Outputs the Activity ID and\nRun ID.\n\n```\ntemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" } s.Command.Args = cobra.NoArgs s.ActivityStartOptions.BuildFlags(s.Command.Flags()) @@ -860,11 +856,11 @@ func NewTemporalActivityTerminateCommand(cctx *CommandContext, parent *TemporalA s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "terminate [flags]" - s.Command.Short = "Terminate an Activity Execution (Experimental)" + s.Command.Short = "Terminate a Standalone Activity Execution (Experimental)" if hasHighlighting { - s.Command.Long = "Terminate an Activity Execution:\n\n\x1b[1mtemporal activity terminate \\\n --activity-id YourActivityId \\\n --reason YourReason\x1b[0m\n\nActivity code cannot see or respond to terminations. To\nperform clean-up work, use \x1b[1mtemporal activity cancel\x1b[0m instead." + s.Command.Long = "Terminate a Standalone Activity Execution.\n\n\x1b[1mtemporal activity terminate \\\n --activity-id YourActivityId \\\n --reason YourReason\x1b[0m\n\nActivity code cannot see or respond to terminations. To\nperform clean-up work, use \x1b[1mtemporal activity cancel\x1b[0m instead." } else { - s.Command.Long = "Terminate an Activity Execution:\n\n```\ntemporal activity terminate \\\n --activity-id YourActivityId \\\n --reason YourReason\n```\n\nActivity code cannot see or respond to terminations. To\nperform clean-up work, use `temporal activity cancel` instead." + s.Command.Long = "Terminate a Standalone Activity Execution.\n\n```\ntemporal activity terminate \\\n --activity-id YourActivityId \\\n --reason YourReason\n```\n\nActivity code cannot see or respond to terminations. To\nperform clean-up work, use `temporal activity cancel` instead." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.Reason, "reason", "", "Reason for termination. Defaults to a message with the current user's name.") @@ -896,9 +892,9 @@ func NewTemporalActivityUnpauseCommand(cctx *CommandContext, parent *TemporalAct s.Command.Use = "unpause [flags]" s.Command.Short = "Unpause an Activity" if hasHighlighting { - s.Command.Long = "Re-schedule a previously-paused Activity for execution.\nNot supported for standalone Activities.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires.\n\nUse \x1b[1m--reset-attempts\x1b[0m to reset the number of previous run attempts to\nzero. For example, if an Activity is near the maximum number of attempts\nN specified in its retry policy, \x1b[1m--reset-attempts\x1b[0m will allow the\nActivity to be retried another N times after unpausing.\n\nUse \x1b[1m--reset-heartbeat\x1b[0m to reset the Activity's heartbeats.\n\nActivities can be specified by their Activity ID or Activity Type.\nOne of those parameters must be provided.\n\nSpecify the Activity ID or Type and Workflow IDs:\n\n\x1b[1mtemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset-attempts\n --reset-heartbeats\x1b[0m\n\nActivities can be unpaused in bulk via a visibility Query list filter.\nFor example, if you want to unpause activities of type Foo that you\npreviously paused, do:\n\n\x1b[1mtemporal activity unpause \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\x1b[0m" + s.Command.Long = "Re-schedule a previously-paused Activity for execution.\nNot supported for Standalone Activities.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires.\n\nUse \x1b[1m--reset-attempts\x1b[0m to reset the number of previous run attempts to\nzero. For example, if an Activity is near the maximum number of attempts\nN specified in its retry policy, \x1b[1m--reset-attempts\x1b[0m will allow the\nActivity to be retried another N times after unpausing.\n\nUse \x1b[1m--reset-heartbeat\x1b[0m to reset the Activity's heartbeats.\n\nActivities can be specified by their Activity ID or Activity Type.\nOne of those parameters must be provided.\n\nSpecify the Activity ID or Type and Workflow IDs:\n\n\x1b[1mtemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset-attempts\n --reset-heartbeats\x1b[0m\n\nActivities can be unpaused in bulk via a visibility Query list filter.\nFor example, if you want to unpause activities of type Foo that you\npreviously paused, do:\n\n\x1b[1mtemporal activity unpause \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\x1b[0m" } else { - s.Command.Long = "Re-schedule a previously-paused Activity for execution.\nNot supported for standalone Activities.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires.\n\nUse `--reset-attempts` to reset the number of previous run attempts to\nzero. For example, if an Activity is near the maximum number of attempts\nN specified in its retry policy, `--reset-attempts` will allow the\nActivity to be retried another N times after unpausing.\n\nUse `--reset-heartbeat` to reset the Activity's heartbeats.\n\nActivities can be specified by their Activity ID or Activity Type.\nOne of those parameters must be provided.\n\nSpecify the Activity ID or Type and Workflow IDs:\n\n```\ntemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset-attempts\n --reset-heartbeats\n```\n\nActivities can be unpaused in bulk via a visibility Query list filter.\nFor example, if you want to unpause activities of type Foo that you\npreviously paused, do:\n\n```\ntemporal activity unpause \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n```" + s.Command.Long = "Re-schedule a previously-paused Activity for execution.\nNot supported for Standalone Activities.\n\nIf the Activity is not running and is past its retry timeout, it will be\nscheduled immediately. Otherwise, it will be scheduled after its retry\ntimeout expires.\n\nUse `--reset-attempts` to reset the number of previous run attempts to\nzero. For example, if an Activity is near the maximum number of attempts\nN specified in its retry policy, `--reset-attempts` will allow the\nActivity to be retried another N times after unpausing.\n\nUse `--reset-heartbeat` to reset the Activity's heartbeats.\n\nActivities can be specified by their Activity ID or Activity Type.\nOne of those parameters must be provided.\n\nSpecify the Activity ID or Type and Workflow IDs:\n\n```\ntemporal activity unpause \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId\n --reset-attempts\n --reset-heartbeats\n```\n\nActivities can be unpaused in bulk via a visibility Query list filter.\nFor example, if you want to unpause activities of type Foo that you\npreviously paused, do:\n\n```\ntemporal activity unpause \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "The Activity ID to unpause. Mutually exclusive with `--query`, `--match-all`, and `--activity-type`. Requires `--workflow-id` to be specified.") @@ -943,9 +939,9 @@ func NewTemporalActivityUpdateOptionsCommand(cctx *CommandContext, parent *Tempo s.Command.Use = "update-options [flags]" s.Command.Short = "Update Activity options" if hasHighlighting { - s.Command.Long = "Update the options of a running Activity that were passed into it from\na Workflow. Updates are incremental, only changing the specified options.\nNot supported for standalone Activities.\n\nFor example:\n\n\x1b[1mtemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\x1b[0m\n\nYou may follow this command with \x1b[1mtemporal activity reset\x1b[0m, and the new values will apply after the reset.\n\nEither \x1b[1mactivity-id\x1b[0m, \x1b[1mactivity-type\x1b[0m, or \x1b[1m--match-all\x1b[0m must be specified.\n\nActivity options can be updated in bulk with a visibility query list filter.\nFor example, if you want to reset for activities of type Foo, do:\n\n\x1b[1mtemporal activity update-options \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n ...\x1b[0m" + s.Command.Long = "Update the options of a running Activity that were passed into it from\na Workflow. Updates are incremental, only changing the specified options.\nNot supported for Standalone Activities.\n\nFor example:\n\n\x1b[1mtemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\x1b[0m\n\nYou may follow this command with \x1b[1mtemporal activity reset\x1b[0m, and the new values will apply after the reset.\n\nEither \x1b[1mactivity-id\x1b[0m, \x1b[1mactivity-type\x1b[0m, or \x1b[1m--match-all\x1b[0m must be specified.\n\nActivity options can be updated in bulk with a visibility query list filter.\nFor example, if you want to reset for activities of type Foo, do:\n\n\x1b[1mtemporal activity update-options \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n ...\x1b[0m" } else { - s.Command.Long = "Update the options of a running Activity that were passed into it from\na Workflow. Updates are incremental, only changing the specified options.\nNot supported for standalone Activities.\n\nFor example:\n\n```\ntemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\n```\n\nYou may follow this command with `temporal activity reset`, and the new values will apply after the reset.\n\nEither `activity-id`, `activity-type`, or `--match-all` must be specified.\n\nActivity options can be updated in bulk with a visibility query list filter.\nFor example, if you want to reset for activities of type Foo, do:\n\n```\ntemporal activity update-options \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n ...\n```" + s.Command.Long = "Update the options of a running Activity that were passed into it from\na Workflow. Updates are incremental, only changing the specified options.\nNot supported for Standalone Activities.\n\nFor example:\n\n```\ntemporal activity update-options \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --task-queue NewTaskQueueName \\\n --schedule-to-close-timeout DURATION \\\n --schedule-to-start-timeout DURATION \\\n --start-to-close-timeout DURATION \\\n --heartbeat-timeout DURATION \\\n --retry-initial-interval DURATION \\\n --retry-maximum-interval DURATION \\\n --retry-backoff-coefficient NewBackoffCoefficient \\\n --retry-maximum-attempts NewMaximumAttempts\n```\n\nYou may follow this command with `temporal activity reset`, and the new values will apply after the reset.\n\nEither `activity-id`, `activity-type`, or `--match-all` must be specified.\n\nActivity options can be updated in bulk with a visibility query list filter.\nFor example, if you want to reset for activities of type Foo, do:\n\n```\ntemporal activity update-options \\\n --query 'TemporalPauseInfo=\"property:activityType=Foo\"'\n ...\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.ActivityId, "activity-id", "a", "", "The Activity ID to update options. Mutually exclusive with `--query`, `--match-all`, and `--activity-type`. Requires `--workflow-id` to be specified.") @@ -2599,9 +2595,9 @@ func NewTemporalTaskQueueDescribeCommand(cctx *CommandContext, parent *TemporalT s.Command.Use = "describe [flags]" s.Command.Short = "Show active Workers" if hasHighlighting { - s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A \x1b[1mLastAccessTime\x1b[0m over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue\x1b[0m\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\x1b[0m\n\nThis command provides the following task queue statistics:\n- \x1b[1mApproximateBacklogCount\x1b[0m: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- \x1b[1mApproximateBacklogAge\x1b[0m: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- \x1b[1mTasksAddRate\x1b[0m: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mTasksDispatchRate\x1b[0m: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mBacklogIncreaseRate\x1b[0m: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n \x1b[1mTasksAddRate\x1b[0m - \x1b[1mTasksDispatchRate\x1b[0m.\n\nNOTE: The \x1b[1mTasksAddRate\x1b[0m and \x1b[1mTasksDispatchRate\x1b[0m metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of \x1b[1mBacklogIncreaseRate\x1b[0m is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag \x1b[1m--report-reachability\x1b[0m:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\x1b[0m\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed\nin a future release. Also, determining task reachability incurs a non-trivial\ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- \x1b[1mReachable\x1b[0m: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- \x1b[1mClosedWorkflowsOnly\x1b[0m: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- \x1b[1mUnreachable\x1b[0m: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, \x1b[1mReachable\x1b[0m is\nmore conservative than \x1b[1mClosedWorkflowsOnly\x1b[0m." + s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A \x1b[1mLastAccessTime\x1b[0m over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue\x1b[0m\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\x1b[0m\n\nThis command provides the following task queue statistics:\n- \x1b[1mApproximateBacklogCount\x1b[0m: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- \x1b[1mApproximateBacklogAge\x1b[0m: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- \x1b[1mTasksAddRate\x1b[0m: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mTasksDispatchRate\x1b[0m: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mBacklogIncreaseRate\x1b[0m: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n \x1b[1mTasksAddRate\x1b[0m - \x1b[1mTasksDispatchRate\x1b[0m.\n\nNOTE: The \x1b[1mTasksAddRate\x1b[0m and \x1b[1mTasksDispatchRate\x1b[0m metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of \x1b[1mBacklogIncreaseRate\x1b[0m is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag \x1b[1m--report-reachability\x1b[0m:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\x1b[0m\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed \nin a future release. Also, determining task reachability incurs a non-trivial \ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- \x1b[1mReachable\x1b[0m: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- \x1b[1mClosedWorkflowsOnly\x1b[0m: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- \x1b[1mUnreachable\x1b[0m: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, \x1b[1mReachable\x1b[0m is\nmore conservative than \x1b[1mClosedWorkflowsOnly\x1b[0m." } else { - s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A `LastAccessTime` over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue\n```\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\n```\n\nThis command provides the following task queue statistics:\n- `ApproximateBacklogCount`: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- `ApproximateBacklogAge`: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- `TasksAddRate`: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `TasksDispatchRate`: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `BacklogIncreaseRate`: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n `TasksAddRate` - `TasksDispatchRate`.\n\nNOTE: The `TasksAddRate` and `TasksDispatchRate` metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of `BacklogIncreaseRate` is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag `--report-reachability`:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\n```\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed\nin a future release. Also, determining task reachability incurs a non-trivial\ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- `Reachable`: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- `ClosedWorkflowsOnly`: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- `Unreachable`: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, `Reachable` is\nmore conservative than `ClosedWorkflowsOnly`." + s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A `LastAccessTime` over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue\n```\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\n```\n\nThis command provides the following task queue statistics:\n- `ApproximateBacklogCount`: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- `ApproximateBacklogAge`: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- `TasksAddRate`: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `TasksDispatchRate`: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `BacklogIncreaseRate`: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n `TasksAddRate` - `TasksDispatchRate`.\n\nNOTE: The `TasksAddRate` and `TasksDispatchRate` metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of `BacklogIncreaseRate` is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag `--report-reachability`:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\n```\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed \nin a future release. Also, determining task reachability incurs a non-trivial \ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- `Reachable`: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- `ClosedWorkflowsOnly`: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- `Unreachable`: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, `Reachable` is\nmore conservative than `ClosedWorkflowsOnly`." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.TaskQueue, "task-queue", "t", "", "Task Queue name. Required.") @@ -3354,9 +3350,9 @@ func NewTemporalWorkerDeploymentManagerIdentityCommand(cctx *CommandContext, par s.Command.Use = "manager-identity" s.Command.Short = "Manager Identity commands change the `ManagerIdentity` of a Worker Deployment" if hasHighlighting { - s.Command.Long = "Manager Identity commands change the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment:\n\n\x1b[1mtemporal worker deployment manager-identity [command] [options]\x1b[0m\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with \x1b[1mdescribe\x1b[0m:\n\x1b[1m temporal worker deployment describe \\\n --deployment-name YourDeploymentName\x1b[0m" + s.Command.Long = "Manager Identity commands change the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment:\n\n\x1b[1mtemporal worker deployment manager-identity [command] [options]\x1b[0m\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with \x1b[1mdescribe\x1b[0m:\n\x1b[1m temporal worker deployment describe \\\n --deployment-name YourDeploymentName\x1b[0m" } else { - s.Command.Long = "Manager Identity commands change the `ManagerIdentity` of a Worker Deployment:\n\n```\ntemporal worker deployment manager-identity [command] [options]\n```\n\nWhen present, `ManagerIdentity` is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with `describe`:\n```\n temporal worker deployment describe \\\n --deployment-name YourDeploymentName\n```" + s.Command.Long = "Manager Identity commands change the `ManagerIdentity` of a Worker Deployment:\n\n```\ntemporal worker deployment manager-identity [command] [options]\n```\n\nWhen present, `ManagerIdentity` is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with `describe`:\n```\n temporal worker deployment describe \\\n --deployment-name YourDeploymentName\n```" } s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalWorkerDeploymentManagerIdentitySetCommand(cctx, &s).Command) @@ -3380,9 +3376,9 @@ func NewTemporalWorkerDeploymentManagerIdentitySetCommand(cctx *CommandContext, s.Command.Use = "set [flags]" s.Command.Short = "Set the Manager Identity of a Worker Deployment" if hasHighlighting { - s.Command.Long = "Set the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity set [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\x1b[0m\n\nSets the Manager Identity of the Deployment to the identity of the user making\nthis request. If you don't specifically pass an identity field, the CLI will\ngenerate your identity for you.\n\nFor example:\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\x1b[0m\n\nSets the Manager Identity of the Deployment to any string." + s.Command.Long = "Set the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity set [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\x1b[0m\n\nSets the Manager Identity of the Deployment to the identity of the user making \nthis request. If you don't specifically pass an identity field, the CLI will \ngenerate your identity for you.\n\nFor example:\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\x1b[0m\n\nSets the Manager Identity of the Deployment to any string." } else { - s.Command.Long = "Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity set [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\n```\n\nSets the Manager Identity of the Deployment to the identity of the user making\nthis request. If you don't specifically pass an identity field, the CLI will\ngenerate your identity for you.\n\nFor example:\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\n```\n\nSets the Manager Identity of the Deployment to any string." + s.Command.Long = "Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity set [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\n```\n\nSets the Manager Identity of the Deployment to the identity of the user making \nthis request. If you don't specifically pass an identity field, the CLI will \ngenerate your identity for you.\n\nFor example:\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\n```\n\nSets the Manager Identity of the Deployment to any string." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.ManagerIdentity, "manager-identity", "", "New Manager Identity. Required unless --self is specified.") @@ -3411,9 +3407,9 @@ func NewTemporalWorkerDeploymentManagerIdentityUnsetCommand(cctx *CommandContext s.Command.Use = "unset [flags]" s.Command.Short = "Unset the Manager Identity of a Worker Deployment" if hasHighlighting { - s.Command.Long = "Unset the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity unset [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\x1b[0m\n\nClears the Manager Identity field for a given Deployment." + s.Command.Long = "Unset the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity unset [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\x1b[0m\n\nClears the Manager Identity field for a given Deployment." } else { - s.Command.Long = "Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity unset [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\n```\n\nClears the Manager Identity field for a given Deployment." + s.Command.Long = "Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity unset [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\n```\n\nClears the Manager Identity field for a given Deployment." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.DeploymentName, "deployment-name", "", "Name for a Worker Deployment. Required.") @@ -3669,9 +3665,9 @@ func NewTemporalWorkflowCountCommand(cctx *CommandContext, parent *TemporalWorkf s.Command.Use = "count [flags]" s.Command.Short = "Count Workflow Executions" if hasHighlighting { - s.Command.Long = "Return a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use \x1b[1m--query\x1b[0m to select a subset of Workflow Executions:\n\n\x1b[1mtemporal workflow count \\\n --query YourQuery\x1b[0m\n\nTODO: show an example query\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." + s.Command.Long = "Return a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use \x1b[1m--query\x1b[0m to select a subset of Workflow Executions:\n\n\x1b[1mtemporal workflow count \\\n --query YourQuery\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." } else { - s.Command.Long = "Return a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use `--query` to select a subset of Workflow Executions:\n\n```\ntemporal workflow count \\\n --query YourQuery\n```\n\nTODO: show an example query\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." + s.Command.Long = "Return a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use `--query` to select a subset of Workflow Executions:\n\n```\ntemporal workflow count \\\n --query YourQuery\n```\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Content for an SQL-like `QUERY` List Filter.") @@ -3696,9 +3692,9 @@ func NewTemporalWorkflowDeleteCommand(cctx *CommandContext, parent *TemporalWork s.Command.Use = "delete [flags]" s.Command.Short = "Delete Workflow Execution" if hasHighlighting { - s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n\x1b[1mtemporal workflow delete \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference.\n\nTODO: does this actually operate on batches and accept a query? It's not documented here, and\nI don't see the functionality in DeleteWorkflowExecution." + s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n\x1b[1mtemporal workflow delete \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." } else { - s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n```\ntemporal workflow delete \\\n --workflow-id YourWorkflowId\n```\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference.\n\nTODO: does this actually operate on batches and accept a query? It's not documented here, and\nI don't see the functionality in DeleteWorkflowExecution." + s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n```\ntemporal workflow delete \\\n --workflow-id YourWorkflowId\n```\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." } s.Command.Args = cobra.NoArgs s.SingleWorkflowOrBatchOptions.BuildFlags(s.Command.Flags()) @@ -3723,7 +3719,7 @@ func NewTemporalWorkflowDescribeCommand(cctx *CommandContext, parent *TemporalWo s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "describe [flags]" - s.Command.Short = "Describe Workflow Execution" + s.Command.Short = "Show Workflow Execution info" if hasHighlighting { s.Command.Long = "Display information about a Workflow Execution:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId\x1b[0m\n\nShow the Workflow Execution's auto-reset points:\n\n\x1b[1mtemporal workflow describe \\\n --workflow-id YourWorkflowId \\\n --reset-points true\x1b[0m" } else { @@ -3757,9 +3753,9 @@ func NewTemporalWorkflowExecuteCommand(cctx *CommandContext, parent *TemporalWor s.Command.Use = "execute [flags]" s.Command.Short = "Start a Workflow Execution and wait for completion" if hasHighlighting { - s.Command.Long = "Start a new Workflow Execution and direct its progress to stdout. The\ncommand blocks and returns when the Workflow Execution completes:\n\n\x1b[1mtemporal workflow execute\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m\n\nUse \x1b[1m--event-details\x1b[0m to relay updates to the command-line output in JSON\nformat. When using JSON output (\x1b[1m--output json\x1b[0m), this includes the entire\n\"history\" JSON key for the run." + s.Command.Long = "Start a new Workflow Execution and direct its progress to stdout. The\ncommand blocks and returns when the Workflow Execution completes:\n\n\x1b[1mtemporal workflow execute \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m\n\nUse \x1b[1m--event-details\x1b[0m to relay updates to the command-line output in JSON\nformat. When using JSON output (\x1b[1m--output json\x1b[0m), this includes the entire\n\"history\" JSON key for the run." } else { - s.Command.Long = "Start a new Workflow Execution and direct its progress to stdout. The\ncommand blocks and returns when the Workflow Execution completes:\n\n```\ntemporal workflow execute\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```\n\nUse `--event-details` to relay updates to the command-line output in JSON\nformat. When using JSON output (`--output json`), this includes the entire\n\"history\" JSON key for the run." + s.Command.Long = "Start a new Workflow Execution and direct its progress to stdout. The\ncommand blocks and returns when the Workflow Execution completes:\n\n```\ntemporal workflow execute \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```\n\nUse `--event-details` to relay updates to the command-line output in JSON\nformat. When using JSON output (`--output json`), this includes the entire\n\"history\" JSON key for the run." } s.Command.Args = cobra.NoArgs s.Command.Flags().BoolVar(&s.Detailed, "detailed", false, "Display events as sections instead of table. Does not apply to JSON output.") @@ -3875,9 +3871,9 @@ func NewTemporalWorkflowListCommand(cctx *CommandContext, parent *TemporalWorkfl s.Command.Use = "list [flags]" s.Command.Short = "Show Workflow Executions" if hasHighlighting { - s.Command.Long = "List Workflow Executions. The optional \x1b[1m--query\x1b[0m limits the output to\nWorkflows matching a Query:\n\n\x1b[1mtemporal workflow list \\\n --query YourQuery\x1b[0m\n\nTODO: show an example query\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference.\n\nView a list of archived Workflow Executions:\n\n\x1b[1mtemporal workflow list \\\n --archived\x1b[0m" + s.Command.Long = "List Workflow Executions. The optional \x1b[1m--query\x1b[0m limits the output to\nWorkflows matching a Query:\n\n\x1b[1mtemporal workflow list \\\n --query YourQuery\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference.\n\nView a list of archived Workflow Executions:\n\n\x1b[1mtemporal workflow list \\\n --archived\x1b[0m" } else { - s.Command.Long = "List Workflow Executions. The optional `--query` limits the output to\nWorkflows matching a Query:\n\n```\ntemporal workflow list \\\n --query YourQuery\n```\n\nTODO: show an example query\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference.\n\nView a list of archived Workflow Executions:\n\n```\ntemporal workflow list \\\n --archived\n```" + s.Command.Long = "List Workflow Executions. The optional `--query` limits the output to\nWorkflows matching a Query:\n\n```\ntemporal workflow list \\\n --query YourQuery\n```\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference.\n\nView a list of archived Workflow Executions:\n\n```\ntemporal workflow list \\\n --archived\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Content for an SQL-like `QUERY` List Filter.") @@ -4069,9 +4065,9 @@ func NewTemporalWorkflowResultCommand(cctx *CommandContext, parent *TemporalWork s.Command.Use = "result [flags]" s.Command.Short = "Wait for and output the result of a Workflow Execution" if hasHighlighting { - s.Command.Long = "TODO: Let's use 'output' as the verb in such situations, rather than 'print' or 'return'.\n\nWait for and output the result of a Workflow Execution:\n\n\x1b[1mtemporal workflow result \\\n --workflow-id YourWorkflowId\x1b[0m" + s.Command.Long = "Wait for and output the result of a Workflow Execution:\n\n\x1b[1mtemporal workflow result \\\n --workflow-id YourWorkflowId\x1b[0m" } else { - s.Command.Long = "TODO: Let's use 'output' as the verb in such situations, rather than 'print' or 'return'.\n\nWait for and output the result of a Workflow Execution:\n\n```\ntemporal workflow result \\\n --workflow-id YourWorkflowId\n```" + s.Command.Long = "Wait for and output the result of a Workflow Execution:\n\n```\ntemporal workflow result \\\n --workflow-id YourWorkflowId\n```" } s.Command.Args = cobra.NoArgs s.WorkflowReferenceOptions.BuildFlags(s.Command.Flags()) @@ -4240,9 +4236,9 @@ func NewTemporalWorkflowStartCommand(cctx *CommandContext, parent *TemporalWorkf s.Command.Use = "start [flags]" s.Command.Short = "Start a Workflow Execution" if hasHighlighting { - s.Command.Long = "Start a new Workflow Execution. Outputs the Workflow ID and Run ID:\n\n\x1b[1mtemporal workflow start \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" + s.Command.Long = "Start a new Workflow Execution without waiting for it to complete.\nUse \x1b[1mtemporal workflow execute\x1b[0m to start and wait for completion.\nOutputs the Workflow ID and Run ID:\n\n\x1b[1mtemporal workflow start \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" } else { - s.Command.Long = "Start a new Workflow Execution. Outputs the Workflow ID and Run ID:\n\n```\ntemporal workflow start \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" + s.Command.Long = "Start a new Workflow Execution without waiting for it to complete.\nUse `temporal workflow execute` to start and wait for completion.\nOutputs the Workflow ID and Run ID:\n\n```\ntemporal workflow start \\\n --workflow-id YourWorkflowId \\\n --type YourWorkflow \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" } s.Command.Args = cobra.NoArgs s.SharedWorkflowStartOptions.BuildFlags(s.Command.Flags()) @@ -4331,7 +4327,7 @@ func NewTemporalWorkflowTerminateCommand(cctx *CommandContext, parent *TemporalW s.Parent = parent s.Command.DisableFlagsInUseLine = true s.Command.Use = "terminate [flags]" - s.Command.Short = "Terminate a Workflow Execution" + s.Command.Short = "Forcefully end a Workflow Execution" if hasHighlighting { s.Command.Long = "Terminate (forcefully end) a Workflow Execution:\n\n\x1b[1mtemporal workflow terminate \\\n --reason YourReasonForTermination \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe reason is optional and defaults to the current user's name. The reason\nis stored in the Event History as part of the \x1b[1mWorkflowExecutionTerminated\x1b[0m\nevent. This becomes the closing Event in the Workflow Execution's history.\n\nExecutions may be terminated in bulk via a visibility Query list filter:\n\n\x1b[1mtemporal workflow terminate \\\n --query YourQuery \\\n --reason YourReasonForTermination\x1b[0m\n\nWorkflow code cannot see or respond to terminations. To perform clean-up work\nin your Workflow code, use \x1b[1mtemporal workflow cancel\x1b[0m instead.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." } else { From 7633e631cedf46fb654f7f200d026c7ff3f2edbb Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 18 Feb 2026 18:37:46 -0500 Subject: [PATCH 17/30] Remove activity delete command (server does not implement DeleteActivityExecution) Neither the Go nor Python SDK exposes this RPC, and the server does not support it yet. --- internal/temporalcli/commands.activity.go | 19 ------------- .../temporalcli/commands.activity_test.go | 2 +- internal/temporalcli/commands.gen.go | 28 ------------------- internal/temporalcli/commands.yaml | 16 ----------- 4 files changed, 1 insertion(+), 64 deletions(-) diff --git a/internal/temporalcli/commands.activity.go b/internal/temporalcli/commands.activity.go index d30772f3d..bbf839a6e 100644 --- a/internal/temporalcli/commands.activity.go +++ b/internal/temporalcli/commands.activity.go @@ -644,25 +644,6 @@ func (c *TemporalActivityTerminateCommand) run(cctx *CommandContext, args []stri return nil } -func (c *TemporalActivityDeleteCommand) run(cctx *CommandContext, args []string) error { - cl, err := dialClient(cctx, &c.Parent.ClientOptions) - if err != nil { - return err - } - defer cl.Close() - - _, err = cl.WorkflowService().DeleteActivityExecution(cctx, &workflowservice.DeleteActivityExecutionRequest{ - Namespace: c.Parent.Namespace, - ActivityId: c.ActivityId, - RunId: c.RunId, - }) - if err != nil { - return fmt.Errorf("failed to delete activity: %w", err) - } - cctx.Printer.Println("Delete activity succeeded") - return nil -} - func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { diff --git a/internal/temporalcli/commands.activity_test.go b/internal/temporalcli/commands.activity_test.go index 79273789a..182212978 100644 --- a/internal/temporalcli/commands.activity_test.go +++ b/internal/temporalcli/commands.activity_test.go @@ -528,7 +528,7 @@ func TestHelp_ActivitySubcommands(t *testing.T) { res := h.Execute("help", "activity") assert.NoError(t, res.Err) out := res.Stdout.String() - for _, sub := range []string{"cancel", "complete", "count", "delete", "describe", "execute", "fail", "list", "result", "start", "terminate"} { + for _, sub := range []string{"cancel", "complete", "count", "describe", "execute", "fail", "list", "result", "start", "terminate"} { assert.Contains(t, out, sub, "missing subcommand %q in activity help", sub) } } diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index bb063ff65..ec388b014 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -458,7 +458,6 @@ func NewTemporalActivityCommand(cctx *CommandContext, parent *TemporalCommand) * s.Command.AddCommand(&NewTemporalActivityCancelCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityCompleteCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityCountCommand(cctx, &s).Command) - s.Command.AddCommand(&NewTemporalActivityDeleteCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityDescribeCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityExecuteCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityFailCommand(cctx, &s).Command) @@ -562,33 +561,6 @@ func NewTemporalActivityCountCommand(cctx *CommandContext, parent *TemporalActiv return &s } -type TemporalActivityDeleteCommand struct { - Parent *TemporalActivityCommand - Command cobra.Command - ActivityReferenceOptions -} - -func NewTemporalActivityDeleteCommand(cctx *CommandContext, parent *TemporalActivityCommand) *TemporalActivityDeleteCommand { - var s TemporalActivityDeleteCommand - s.Parent = parent - s.Command.DisableFlagsInUseLine = true - s.Command.Use = "delete [flags]" - s.Command.Short = "Delete a Standalone Activity Execution (Experimental)" - if hasHighlighting { - s.Command.Long = "Delete a Standalone Activity Execution.\n\n\x1b[1mtemporal activity delete \\\n --activity-id YourActivityId\x1b[0m\n\nThe deletion executes asynchronously. If the Activity\nExecution is running, it will be terminated before deletion." - } else { - s.Command.Long = "Delete a Standalone Activity Execution.\n\n```\ntemporal activity delete \\\n --activity-id YourActivityId\n```\n\nThe deletion executes asynchronously. If the Activity\nExecution is running, it will be terminated before deletion." - } - s.Command.Args = cobra.NoArgs - s.ActivityReferenceOptions.BuildFlags(s.Command.Flags()) - s.Command.Run = func(c *cobra.Command, args []string) { - if err := s.run(cctx, args); err != nil { - cctx.Options.Fail(err) - } - } - return &s -} - type TemporalActivityDescribeCommand struct { Parent *TemporalActivityCommand Command cobra.Command diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index 804a959fd..f9e002e42 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -165,7 +165,6 @@ commands: - activity count - activity cancel - activity terminate - - activity delete - activity execution - activity complete - activity update-options @@ -251,21 +250,6 @@ commands: description: | Query to filter Activity Executions to count. - - name: temporal activity delete - summary: Delete a Standalone Activity Execution (Experimental) - description: | - Delete a Standalone Activity Execution. - - ``` - temporal activity delete \ - --activity-id YourActivityId - ``` - - The deletion executes asynchronously. If the Activity - Execution is running, it will be terminated before deletion. - option-sets: - - activity-reference - - name: temporal activity describe summary: Describe a Standalone Activity Execution (Experimental) description: | From 22f0b2f9fca947a1b5716803cd1b062ba66ad410 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 18 Feb 2026 20:55:10 -0500 Subject: [PATCH 18/30] Add required timeout flags to activity start/execute examples The examples were missing the required timeout, which is confusing since either schedule-to-close-timeout or start-to-close-timeout must be provided. Use different timeouts in each example to illustrate both options. --- internal/temporalcli/commands.gen.go | 8 ++++---- internal/temporalcli/commands.yaml | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index ec388b014..7847afa7e 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -604,9 +604,9 @@ func NewTemporalActivityExecuteCommand(cctx *CommandContext, parent *TemporalAct s.Command.Use = "execute [flags]" s.Command.Short = "Start a Standalone Activity Execution and wait for completion (Experimental)" if hasHighlighting { - s.Command.Long = "Start a new Standalone Activity Execution and block until it completes.\nThe result is output to stdout.\n\n\x1b[1mtemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" + s.Command.Long = "Start a new Standalone Activity Execution and block until it completes.\nThe result is output to stdout.\n\n\x1b[1mtemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --start-to-close-timeout 30s \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" } else { - s.Command.Long = "Start a new Standalone Activity Execution and block until it completes.\nThe result is output to stdout.\n\n```\ntemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" + s.Command.Long = "Start a new Standalone Activity Execution and block until it completes.\nThe result is output to stdout.\n\n```\ntemporal activity execute \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --start-to-close-timeout 30s \\\n --input '{\"some-key\": \"some-value\"}'\n```" } s.Command.Args = cobra.NoArgs s.ActivityStartOptions.BuildFlags(s.Command.Flags()) @@ -801,9 +801,9 @@ func NewTemporalActivityStartCommand(cctx *CommandContext, parent *TemporalActiv s.Command.Use = "start [flags]" s.Command.Short = "Start a new Standalone Activity Execution (Experimental)" if hasHighlighting { - s.Command.Long = "Start a new Standalone Activity Execution. Outputs the Activity ID and\nRun ID.\n\n\x1b[1mtemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" + s.Command.Long = "Start a new Standalone Activity Execution. Outputs the Activity ID and\nRun ID.\n\n\x1b[1mtemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --schedule-to-close-timeout 5m \\\n --input '{\"some-key\": \"some-value\"}'\x1b[0m" } else { - s.Command.Long = "Start a new Standalone Activity Execution. Outputs the Activity ID and\nRun ID.\n\n```\ntemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --input '{\"some-key\": \"some-value\"}'\n```" + s.Command.Long = "Start a new Standalone Activity Execution. Outputs the Activity ID and\nRun ID.\n\n```\ntemporal activity start \\\n --activity-id YourActivityId \\\n --type YourActivity \\\n --task-queue YourTaskQueue \\\n --schedule-to-close-timeout 5m \\\n --input '{\"some-key\": \"some-value\"}'\n```" } s.Command.Args = cobra.NoArgs s.ActivityStartOptions.BuildFlags(s.Command.Flags()) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index f9e002e42..52347dea1 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -277,6 +277,7 @@ commands: --activity-id YourActivityId \ --type YourActivity \ --task-queue YourTaskQueue \ + --start-to-close-timeout 30s \ --input '{"some-key": "some-value"}' ``` option-sets: @@ -667,6 +668,7 @@ commands: --activity-id YourActivityId \ --type YourActivity \ --task-queue YourTaskQueue \ + --schedule-to-close-timeout 5m \ --input '{"some-key": "some-value"}' ``` option-sets: From c5af2d9e286badaf637c7868c1c2311439f968b6 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 18 Feb 2026 22:18:02 -0500 Subject: [PATCH 19/30] Fix activity execute/result: re-poll on empty long-poll response The server returns an empty non-error PollActivityExecution response when the long-poll timeout (default 20s) expires before the activity completes. This is the server's signal to re-issue the poll. Both execute and result were making a single call and treating the nil outcome as a terminal error. Extract shared pollActivityOutcome that loops until an outcome arrives. --- internal/temporalcli/commands.activity.go | 46 ++++++++++++++--------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/internal/temporalcli/commands.activity.go b/internal/temporalcli/commands.activity.go index bbf839a6e..7f5a64201 100644 --- a/internal/temporalcli/commands.activity.go +++ b/internal/temporalcli/commands.activity.go @@ -1,6 +1,7 @@ package temporalcli import ( + "context" "fmt" "time" @@ -470,15 +471,7 @@ func (c *TemporalActivityExecuteCommand) run(cctx *CommandContext, args []string if err != nil { return fmt.Errorf("failed starting activity: %w", err) } - pollResp, err := cl.WorkflowService().PollActivityExecution(cctx, &workflowservice.PollActivityExecutionRequest{ - Namespace: c.Parent.Namespace, - ActivityId: c.ActivityId, - RunId: startResp.RunId, - }) - if err != nil { - return fmt.Errorf("failed polling activity result: %w", err) - } - return printActivityOutcome(cctx, pollResp.Outcome) + return pollActivityOutcome(cctx, cl.WorkflowService(), c.Parent.Namespace, c.ActivityId, startResp.RunId) } func (c *TemporalActivityDescribeCommand) run(cctx *CommandContext, args []string) error { @@ -651,17 +644,36 @@ func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) } defer cl.Close() - resp, err := cl.WorkflowService().PollActivityExecution(cctx, &workflowservice.PollActivityExecutionRequest{ - Namespace: c.Parent.Namespace, - ActivityId: c.ActivityId, - RunId: c.RunId, - }) - if err != nil { - return fmt.Errorf("failed polling activity result: %w", err) + return pollActivityOutcome(cctx, cl.WorkflowService(), c.Parent.Namespace, c.ActivityId, c.RunId) +} + +// pollActivityOutcome long-polls for the activity's outcome, re-issuing the +// poll when the server returns an empty response (its signal to keep polling). +// Each iteration uses a per-RPC timeout as a safety net against network hangs, +// consistent with the Go SDK's long-poll pattern. +func pollActivityOutcome(cctx *CommandContext, svc workflowservice.WorkflowServiceClient, ns, activityID, runID string) error { + for { + rpcCtx, cancel := context.WithTimeout(cctx, longPollPerRPCTimeout) + resp, err := svc.PollActivityExecution(rpcCtx, &workflowservice.PollActivityExecutionRequest{ + Namespace: ns, + ActivityId: activityID, + RunId: runID, + }) + cancel() + if err != nil { + if cctx.Err() != nil { + return cctx.Err() + } + return fmt.Errorf("failed polling activity result: %w", err) + } + if resp.Outcome != nil { + return printActivityOutcome(cctx, resp.Outcome) + } } - return printActivityOutcome(cctx, resp.Outcome) } +const longPollPerRPCTimeout = 70 * time.Second + func buildStartActivityRequest( cctx *CommandContext, parent *TemporalActivityCommand, From 203a85b5bab201a3e6ea6d5cfb81f21fe1565cf3 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 18 Feb 2026 23:41:33 -0500 Subject: [PATCH 20/30] Add test for long-poll retry in activity execute Verifies that pollActivityOutcome retries when the server returns an empty PollActivityExecution response (nil outcome), rather than treating it as a terminal error. Uses a gRPC interceptor to simulate the long-poll timeout on the first poll, then return a result on the second. Without the fix in 384741e, this test fails with "activity outcome not available". --- .../temporalcli/commands.activity_test.go | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/internal/temporalcli/commands.activity_test.go b/internal/temporalcli/commands.activity_test.go index 182212978..292b3ca78 100644 --- a/internal/temporalcli/commands.activity_test.go +++ b/internal/temporalcli/commands.activity_test.go @@ -9,14 +9,19 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + activitypb "go.temporal.io/api/activity/v1" + "go.temporal.io/api/common/v1" "go.temporal.io/api/enums/v1" "go.temporal.io/api/history/v1" "go.temporal.io/api/serviceerror" "go.temporal.io/api/workflowservice/v1" "go.temporal.io/sdk/client" + "go.temporal.io/sdk/converter" "go.temporal.io/sdk/temporal" "go.temporal.io/sdk/workflow" "google.golang.org/grpc" + "google.golang.org/protobuf/proto" ) const ( @@ -522,6 +527,55 @@ func (s *SharedServerSuite) TestResetActivity_BatchSuccess() { failActivity.Store(false) } +func (s *SharedServerSuite) TestActivityExecute_RetriesOnEmptyPollResponse() { + resultPayload, err := converter.GetDefaultDataConverter().ToPayload("standalone-result") + require.NoError(s.T(), err) + + var pollCount atomic.Int32 + s.CommandHarness.Options.AdditionalClientGRPCDialOptions = append( + s.CommandHarness.Options.AdditionalClientGRPCDialOptions, + grpc.WithChainUnaryInterceptor(func( + ctx context.Context, + method string, req, reply any, + cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption, + ) error { + if _, ok := req.(*workflowservice.StartActivityExecutionRequest); ok { + proto.Merge(reply.(proto.Message), &workflowservice.StartActivityExecutionResponse{ + RunId: "fake-run-id", + Started: true, + }) + return nil + } + if _, ok := req.(*workflowservice.PollActivityExecutionRequest); ok { + if pollCount.Add(1) == 1 { + return nil + } + proto.Merge(reply.(proto.Message), &workflowservice.PollActivityExecutionResponse{ + Outcome: &activitypb.ActivityExecutionOutcome{ + Value: &activitypb.ActivityExecutionOutcome_Result{ + Result: &common.Payloads{Payloads: []*common.Payload{resultPayload}}, + }, + }, + }) + return nil + } + return invoker(ctx, method, req, reply, cc, opts...) + }), + ) + + res := s.Execute( + "activity", "execute", + "--activity-id", "poll-retry-test", + "--type", "DevActivity", + "--task-queue", "fake-tq", + "--start-to-close-timeout", "30s", + "--address", s.Address(), + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "standalone-result") + s.GreaterOrEqual(pollCount.Load(), int32(2)) +} + func TestHelp_ActivitySubcommands(t *testing.T) { h := NewCommandHarness(t) From bea8154e5e5e625e4537c7d4bcecbdd1854d2704 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 00:11:56 -0500 Subject: [PATCH 21/30] Align poll/outcome code with SDK-Go, use integration test - pollActivityOutcome: use `for resp.GetOutcome() == nil` loop matching the SDK-Go's PollActivityResult pattern - printActivityOutcome: use type switch on GetValue() matching SDK-Go style, with informative default case - Enable standalone activities in dev server (history.enableChasm, activity.enableStandalone) with short long-poll timeout (2s) - Rewrite long-poll retry test as proper integration test: activity sleeps 3s, exceeding the 2s long-poll timeout, forcing a retry --- internal/temporalcli/commands.activity.go | 39 +++++++-------- .../temporalcli/commands.activity_test.go | 48 +++---------------- internal/temporalcli/commands_test.go | 3 ++ 3 files changed, 27 insertions(+), 63 deletions(-) diff --git a/internal/temporalcli/commands.activity.go b/internal/temporalcli/commands.activity.go index 7f5a64201..ed30d01b5 100644 --- a/internal/temporalcli/commands.activity.go +++ b/internal/temporalcli/commands.activity.go @@ -647,18 +647,17 @@ func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) return pollActivityOutcome(cctx, cl.WorkflowService(), c.Parent.Namespace, c.ActivityId, c.RunId) } -// pollActivityOutcome long-polls for the activity's outcome, re-issuing the -// poll when the server returns an empty response (its signal to keep polling). -// Each iteration uses a per-RPC timeout as a safety net against network hangs, -// consistent with the Go SDK's long-poll pattern. func pollActivityOutcome(cctx *CommandContext, svc workflowservice.WorkflowServiceClient, ns, activityID, runID string) error { - for { + req := &workflowservice.PollActivityExecutionRequest{ + Namespace: ns, + ActivityId: activityID, + RunId: runID, + } + var resp *workflowservice.PollActivityExecutionResponse + for resp.GetOutcome() == nil { rpcCtx, cancel := context.WithTimeout(cctx, longPollPerRPCTimeout) - resp, err := svc.PollActivityExecution(rpcCtx, &workflowservice.PollActivityExecutionRequest{ - Namespace: ns, - ActivityId: activityID, - RunId: runID, - }) + var err error + resp, err = svc.PollActivityExecution(rpcCtx, req) cancel() if err != nil { if cctx.Err() != nil { @@ -666,10 +665,8 @@ func pollActivityOutcome(cctx *CommandContext, svc workflowservice.WorkflowServi } return fmt.Errorf("failed polling activity result: %w", err) } - if resp.Outcome != nil { - return printActivityOutcome(cctx, resp.Outcome) - } } + return printActivityOutcome(cctx, resp.GetOutcome()) } const longPollPerRPCTimeout = 70 * time.Second @@ -789,14 +786,12 @@ func buildStartActivityRequest( } func printActivityOutcome(cctx *CommandContext, outcome *activitypb.ActivityExecutionOutcome) error { - if outcome == nil { - return fmt.Errorf("activity outcome not available") - } if cctx.JSONOutput { return cctx.Printer.PrintStructured(outcome, printer.StructuredOptions{}) } - if result := outcome.GetResult(); result != nil { - for _, payload := range result.Payloads { + switch v := outcome.GetValue().(type) { + case *activitypb.ActivityExecutionOutcome_Result: + for _, payload := range v.Result.Payloads { var value any if err := converter.GetDefaultDataConverter().FromPayload(payload, &value); err != nil { cctx.Printer.Printlnf("Result: ", err) @@ -805,9 +800,9 @@ func printActivityOutcome(cctx *CommandContext, outcome *activitypb.ActivityExec } } return nil + case *activitypb.ActivityExecutionOutcome_Failure: + return fmt.Errorf("activity failed: %s", v.Failure.GetMessage()) + default: + return fmt.Errorf("unexpected activity outcome type: %T", v) } - if f := outcome.GetFailure(); f != nil { - return fmt.Errorf("activity failed: %s", f.GetMessage()) - } - return fmt.Errorf("activity completed with unknown outcome") } diff --git a/internal/temporalcli/commands.activity_test.go b/internal/temporalcli/commands.activity_test.go index 292b3ca78..a57f8a754 100644 --- a/internal/temporalcli/commands.activity_test.go +++ b/internal/temporalcli/commands.activity_test.go @@ -9,19 +9,14 @@ import ( "time" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - activitypb "go.temporal.io/api/activity/v1" - "go.temporal.io/api/common/v1" "go.temporal.io/api/enums/v1" "go.temporal.io/api/history/v1" "go.temporal.io/api/serviceerror" "go.temporal.io/api/workflowservice/v1" "go.temporal.io/sdk/client" - "go.temporal.io/sdk/converter" "go.temporal.io/sdk/temporal" "go.temporal.io/sdk/workflow" "google.golang.org/grpc" - "google.golang.org/protobuf/proto" ) const ( @@ -528,52 +523,23 @@ func (s *SharedServerSuite) TestResetActivity_BatchSuccess() { } func (s *SharedServerSuite) TestActivityExecute_RetriesOnEmptyPollResponse() { - resultPayload, err := converter.GetDefaultDataConverter().ToPayload("standalone-result") - require.NoError(s.T(), err) - - var pollCount atomic.Int32 - s.CommandHarness.Options.AdditionalClientGRPCDialOptions = append( - s.CommandHarness.Options.AdditionalClientGRPCDialOptions, - grpc.WithChainUnaryInterceptor(func( - ctx context.Context, - method string, req, reply any, - cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption, - ) error { - if _, ok := req.(*workflowservice.StartActivityExecutionRequest); ok { - proto.Merge(reply.(proto.Message), &workflowservice.StartActivityExecutionResponse{ - RunId: "fake-run-id", - Started: true, - }) - return nil - } - if _, ok := req.(*workflowservice.PollActivityExecutionRequest); ok { - if pollCount.Add(1) == 1 { - return nil - } - proto.Merge(reply.(proto.Message), &workflowservice.PollActivityExecutionResponse{ - Outcome: &activitypb.ActivityExecutionOutcome{ - Value: &activitypb.ActivityExecutionOutcome_Result{ - Result: &common.Payloads{Payloads: []*common.Payload{resultPayload}}, - }, - }, - }) - return nil - } - return invoker(ctx, method, req, reply, cc, opts...) - }), - ) + // Activity sleeps longer than the server's activity.longPollTimeout (2s), + // forcing at least one empty poll response before the result arrives. + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + time.Sleep(3 * time.Second) + return "standalone-result", nil + }) res := s.Execute( "activity", "execute", "--activity-id", "poll-retry-test", "--type", "DevActivity", - "--task-queue", "fake-tq", + "--task-queue", s.Worker().Options.TaskQueue, "--start-to-close-timeout", "30s", "--address", s.Address(), ) s.NoError(res.Err) s.Contains(res.Stdout.String(), "standalone-result") - s.GreaterOrEqual(pollCount.Load(), int32(2)) } func TestHelp_ActivitySubcommands(t *testing.T) { diff --git a/internal/temporalcli/commands_test.go b/internal/temporalcli/commands_test.go index 2312e442e..0d5e08805 100644 --- a/internal/temporalcli/commands_test.go +++ b/internal/temporalcli/commands_test.go @@ -233,6 +233,9 @@ func (s *SharedServerSuite) SetupSuite() { "frontend.namespaceRPS.visibility": 10000, // Disable DescribeTaskQueue cache. "frontend.activityAPIsEnabled": true, + "history.enableChasm": true, + "activity.enableStandalone": true, + "activity.longPollTimeout": 2 * time.Second, // this is overridden since we don't want caching to be enabled // while testing DescribeTaskQueue behaviour related to versioning "matching.TaskQueueInfoByBuildIdTTL": 0 * time.Second, From bf0388ec73964facd2e71cbce7febe73a78eb3d5 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 00:21:03 -0500 Subject: [PATCH 22/30] Replace TestHelp_* with integration tests for standalone activity commands Workflow command tests are 100% integration tests (SharedServerSuite), with no TestHelp_* unit tests. Conform to that precedent: - Remove TestHelp_ActivitySubcommands, TestHelp_ActivityStartFlags, TestHelp_ActivityCompleteFlags, TestHelp_ActivityFailFlags - Add integration tests: Start, Execute (success, failure, poll retry), Result, Describe, List, Count, Cancel, Terminate - Add startStandaloneActivity helper for tests that need a running standalone activity --- .../temporalcli/commands.activity_test.go | 235 +++++++++++++++--- 1 file changed, 200 insertions(+), 35 deletions(-) diff --git a/internal/temporalcli/commands.activity_test.go b/internal/temporalcli/commands.activity_test.go index a57f8a754..5beb51ca7 100644 --- a/internal/temporalcli/commands.activity_test.go +++ b/internal/temporalcli/commands.activity_test.go @@ -2,13 +2,13 @@ package temporalcli_test import ( "context" + "encoding/json" "fmt" + "strings" "sync" "sync/atomic" - "testing" "time" - "github.com/stretchr/testify/assert" "go.temporal.io/api/enums/v1" "go.temporal.io/api/history/v1" "go.temporal.io/api/serviceerror" @@ -522,7 +522,99 @@ func (s *SharedServerSuite) TestResetActivity_BatchSuccess() { failActivity.Store(false) } -func (s *SharedServerSuite) TestActivityExecute_RetriesOnEmptyPollResponse() { +// startStandaloneActivity starts a standalone activity via the CLI and returns +// the parsed JSON response containing activityId and runId. +func (s *SharedServerSuite) startStandaloneActivity(activityID string, extraArgs ...string) map[string]any { + args := []string{ + "activity", "start", + "-o", "json", + "--activity-id", activityID, + "--type", "DevActivity", + "--task-queue", s.Worker().Options.TaskQueue, + "--start-to-close-timeout", "30s", + "--address", s.Address(), + } + args = append(args, extraArgs...) + res := s.Execute(args...) + s.NoError(res.Err) + var jsonOut map[string]any + s.NoError(json.Unmarshal(res.Stdout.Bytes(), &jsonOut)) + return jsonOut +} + +func (s *SharedServerSuite) TestStandaloneActivity_Start() { + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + return "start-result", nil + }) + + res := s.Execute( + "activity", "start", + "--activity-id", "start-test", + "--type", "DevActivity", + "--task-queue", s.Worker().Options.TaskQueue, + "--start-to-close-timeout", "30s", + "--address", s.Address(), + ) + s.NoError(res.Err) + out := res.Stdout.String() + s.ContainsOnSameLine(out, "ActivityId", "start-test") + s.Contains(out, "RunId") + s.ContainsOnSameLine(out, "Started", "true") + + // JSON + res = s.Execute( + "activity", "start", + "-o", "json", + "--activity-id", "start-test-json", + "--type", "DevActivity", + "--task-queue", s.Worker().Options.TaskQueue, + "--start-to-close-timeout", "30s", + "--address", s.Address(), + ) + s.NoError(res.Err) + var jsonOut map[string]any + s.NoError(json.Unmarshal(res.Stdout.Bytes(), &jsonOut)) + s.Equal("start-test-json", jsonOut["activityId"]) + s.NotEmpty(jsonOut["runId"]) + s.Equal(true, jsonOut["started"]) +} + +func (s *SharedServerSuite) TestStandaloneActivity_Execute_Success() { + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + return map[string]string{"foo": "bar"}, nil + }) + + res := s.Execute( + "activity", "execute", + "--activity-id", "exec-test", + "--type", "DevActivity", + "--task-queue", s.Worker().Options.TaskQueue, + "--start-to-close-timeout", "30s", + "--address", s.Address(), + ) + s.NoError(res.Err) + s.ContainsOnSameLine(res.Stdout.String(), "Result", `map[foo:bar]`) +} + +func (s *SharedServerSuite) TestStandaloneActivity_Execute_Failure() { + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + return nil, fmt.Errorf("intentional failure") + }) + + res := s.Execute( + "activity", "execute", + "--activity-id", "exec-fail-test", + "--type", "DevActivity", + "--task-queue", s.Worker().Options.TaskQueue, + "--start-to-close-timeout", "30s", + "--retry-maximum-attempts", "1", + "--address", s.Address(), + ) + s.ErrorContains(res.Err, "activity failed") + s.ErrorContains(res.Err, "intentional failure") +} + +func (s *SharedServerSuite) TestStandaloneActivity_Execute_RetriesOnEmptyPollResponse() { // Activity sleeps longer than the server's activity.longPollTimeout (2s), // forcing at least one empty poll response before the result arrives. s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { @@ -542,47 +634,120 @@ func (s *SharedServerSuite) TestActivityExecute_RetriesOnEmptyPollResponse() { s.Contains(res.Stdout.String(), "standalone-result") } -func TestHelp_ActivitySubcommands(t *testing.T) { - h := NewCommandHarness(t) +func (s *SharedServerSuite) TestStandaloneActivity_Result() { + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + return "result-value", nil + }) - res := h.Execute("help", "activity") - assert.NoError(t, res.Err) - out := res.Stdout.String() - for _, sub := range []string{"cancel", "complete", "count", "describe", "execute", "fail", "list", "result", "start", "terminate"} { - assert.Contains(t, out, sub, "missing subcommand %q in activity help", sub) - } + started := s.startStandaloneActivity("result-test") + + res := s.Execute( + "activity", "result", + "--activity-id", "result-test", + "--run-id", started["runId"].(string), + "--address", s.Address(), + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "result-value") } -func TestHelp_ActivityStartFlags(t *testing.T) { - h := NewCommandHarness(t) +func (s *SharedServerSuite) TestStandaloneActivity_Describe() { + activityStarted := make(chan struct{}) + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + close(activityStarted) + <-ctx.Done() + return nil, ctx.Err() + }) + + started := s.startStandaloneActivity("describe-test") + <-activityStarted - res := h.Execute("activity", "start", "--help") - assert.NoError(t, res.Err) + res := s.Execute( + "activity", "describe", + "--activity-id", "describe-test", + "--run-id", started["runId"].(string), + "--address", s.Address(), + ) + s.NoError(res.Err) out := res.Stdout.String() - for _, flag := range []string{"--activity-id", "--type", "--task-queue", "--schedule-to-close-timeout", "--start-to-close-timeout", "--input"} { - assert.Contains(t, out, flag, "missing flag %q in activity start help", flag) - } + s.ContainsOnSameLine(out, "ActivityId", "describe-test") + s.Contains(out, "DevActivity") } -func TestHelp_ActivityCompleteFlags(t *testing.T) { - h := NewCommandHarness(t) +func (s *SharedServerSuite) TestStandaloneActivity_List() { + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + return "listed", nil + }) - res := h.Execute("activity", "complete", "--help") - assert.NoError(t, res.Err) - out := res.Stdout.String() - assert.Contains(t, out, "--activity-id") - assert.Contains(t, out, "--workflow-id") - assert.Contains(t, out, "--result") + s.startStandaloneActivity("list-test-1") + s.startStandaloneActivity("list-test-2") + + s.Eventually(func() bool { + res := s.Execute( + "activity", "list", + "--address", s.Address(), + ) + out := res.Stdout.String() + return res.Err == nil && strings.Contains(out, "list-test-1") && strings.Contains(out, "list-test-2") + }, 5*time.Second, 200*time.Millisecond) } -func TestHelp_ActivityFailFlags(t *testing.T) { - h := NewCommandHarness(t) +func (s *SharedServerSuite) TestStandaloneActivity_Count() { + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + return "counted", nil + }) - res := h.Execute("activity", "fail", "--help") - assert.NoError(t, res.Err) - out := res.Stdout.String() - assert.Contains(t, out, "--activity-id") - assert.Contains(t, out, "--workflow-id") - assert.Contains(t, out, "--detail") - assert.Contains(t, out, "--reason") + s.startStandaloneActivity("count-test") + + s.Eventually(func() bool { + res := s.Execute( + "activity", "count", + "--address", s.Address(), + ) + return res.Err == nil && strings.Contains(res.Stdout.String(), "Total:") + }, 5*time.Second, 200*time.Millisecond) +} + +func (s *SharedServerSuite) TestStandaloneActivity_Cancel() { + activityStarted := make(chan struct{}) + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + close(activityStarted) + <-ctx.Done() + return nil, ctx.Err() + }) + + started := s.startStandaloneActivity("cancel-test") + <-activityStarted + + res := s.Execute( + "activity", "cancel", + "--activity-id", "cancel-test", + "--run-id", started["runId"].(string), + "--reason", "test-cancel", + "--address", s.Address(), + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Cancellation requested") +} + +func (s *SharedServerSuite) TestStandaloneActivity_Terminate() { + activityStarted := make(chan struct{}) + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + close(activityStarted) + <-ctx.Done() + return nil, ctx.Err() + }) + + started := s.startStandaloneActivity("terminate-test") + <-activityStarted + + res := s.Execute( + "activity", "terminate", + "--activity-id", "terminate-test", + "--run-id", started["runId"].(string), + "--reason", "test-terminate", + "--address", s.Address(), + ) + s.NoError(res.Err) + s.Contains(res.Stdout.String(), "Activity terminated") } From e8996251199ee2d25d37732fe6e9d39f5883ae86 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 19:45:17 -0500 Subject: [PATCH 23/30] Address review feedback: revert complete description rewrap, workflow count/delete wording - Revert whitespace-only reformatting of `activity complete` description - Apply "Output a count" for `workflow count` per review suggestion - Apply "queries" for `workflow delete` per review suggestion --- internal/temporalcli/commands.gen.go | 12 ++++++------ internal/temporalcli/commands.yaml | 9 ++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 7847afa7e..9c3492143 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -517,9 +517,9 @@ func NewTemporalActivityCompleteCommand(cctx *CommandContext, parent *TemporalAc s.Command.Use = "complete [flags]" s.Command.Short = "Complete an Activity" if hasHighlighting { - s.Command.Long = "Complete an Activity, marking it as successfully finished.\nSpecify the Activity ID and include a JSON result for the\nreturned value:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\x1b[0m" + s.Command.Long = "Complete an Activity, marking it as successfully finished. Specify the\nActivity ID and include a JSON result for the returned value:\n\n\x1b[1mtemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\x1b[0m" } else { - s.Command.Long = "Complete an Activity, marking it as successfully finished.\nSpecify the Activity ID and include a JSON result for the\nreturned value:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\n```" + s.Command.Long = "Complete an Activity, marking it as successfully finished. Specify the\nActivity ID and include a JSON result for the returned value:\n\n```\ntemporal activity complete \\\n --activity-id YourActivityId \\\n --workflow-id YourWorkflowId \\\n --result '{\"YourResultKey\": \"YourResultVal\"}'\n```" } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.WorkflowId, "workflow-id", "w", "", "Workflow ID. Required for workflow Activities. Omit for Standalone Activities.") @@ -3637,9 +3637,9 @@ func NewTemporalWorkflowCountCommand(cctx *CommandContext, parent *TemporalWorkf s.Command.Use = "count [flags]" s.Command.Short = "Count Workflow Executions" if hasHighlighting { - s.Command.Long = "Return a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use \x1b[1m--query\x1b[0m to select a subset of Workflow Executions:\n\n\x1b[1mtemporal workflow count \\\n --query YourQuery\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." + s.Command.Long = "Output a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use \x1b[1m--query\x1b[0m to select a subset of Workflow Executions:\n\n\x1b[1mtemporal workflow count \\\n --query YourQuery\x1b[0m\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." } else { - s.Command.Long = "Return a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use `--query` to select a subset of Workflow Executions:\n\n```\ntemporal workflow count \\\n --query YourQuery\n```\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." + s.Command.Long = "Output a count of Workflow Executions, regardless of execution state (running,\nterminated, etc). Use `--query` to select a subset of Workflow Executions:\n\n```\ntemporal workflow count \\\n --query YourQuery\n```\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.Query, "query", "q", "", "Content for an SQL-like `QUERY` List Filter.") @@ -3664,9 +3664,9 @@ func NewTemporalWorkflowDeleteCommand(cctx *CommandContext, parent *TemporalWork s.Command.Use = "delete [flags]" s.Command.Short = "Delete Workflow Execution" if hasHighlighting { - s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n\x1b[1mtemporal workflow delete \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." + s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n\x1b[1mtemporal workflow delete \\\n --workflow-id YourWorkflowId\x1b[0m\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand queries. See \x1b[1mtemporal batch --help\x1b[0m for a quick reference." } else { - s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n```\ntemporal workflow delete \\\n --workflow-id YourWorkflowId\n```\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand Query creation. See `temporal batch --help` for a quick reference." + s.Command.Long = "Delete a Workflow Execution and its Event History:\n\n```\ntemporal workflow delete \\\n --workflow-id YourWorkflowId\n```\n\nThe removal executes asynchronously. If the Execution is Running, the Service\nterminates it before deletion.\n\nVisit https://docs.temporal.io/visibility to read more about Search Attributes\nand queries. See `temporal batch --help` for a quick reference." } s.Command.Args = cobra.NoArgs s.SingleWorkflowOrBatchOptions.BuildFlags(s.Command.Flags()) diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index 52347dea1..f5886e84d 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -206,9 +206,8 @@ commands: - name: temporal activity complete summary: Complete an Activity description: | - Complete an Activity, marking it as successfully finished. - Specify the Activity ID and include a JSON result for the - returned value: + Complete an Activity, marking it as successfully finished. Specify the + Activity ID and include a JSON result for the returned value: ``` temporal activity complete \ @@ -3556,7 +3555,7 @@ commands: - name: temporal workflow count summary: Count Workflow Executions description: | - Return a count of Workflow Executions, regardless of execution state (running, + Output a count of Workflow Executions, regardless of execution state (running, terminated, etc). Use `--query` to select a subset of Workflow Executions: ``` @@ -3586,7 +3585,7 @@ commands: terminates it before deletion. Visit https://docs.temporal.io/visibility to read more about Search Attributes - and Query creation. See `temporal batch --help` for a quick reference. + and queries. See `temporal batch --help` for a quick reference. option-sets: - single-workflow-or-batch From a661e6f161e3ef53340e36d0c625d75cae8afc7d Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 20:13:14 -0500 Subject: [PATCH 24/30] Address review feedback: parent description, Temporal Markdown wording MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Apply suggestion: parent description → "Perform operations on Activity Executions." - Replace "Temporal Markdown" with "standard Markdown excluding images, HTML, and script tags" --- internal/temporalcli/commands.gen.go | 26 +++++++------- internal/temporalcli/commands.yaml | 52 ++++++++++++++-------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/internal/temporalcli/commands.gen.go b/internal/temporalcli/commands.gen.go index 9c3492143..7c3c01585 100644 --- a/internal/temporalcli/commands.gen.go +++ b/internal/temporalcli/commands.gen.go @@ -199,8 +199,8 @@ func (v *SharedWorkflowStartOptions) BuildFlags(f *pflag.FlagSet) { f.StringArrayVar(&v.SearchAttribute, "search-attribute", nil, "Search Attribute in `KEY=VALUE` format. Keys must be identifiers, and values must be JSON values. For example: 'YourKey={\"your\": \"value\"}'. Can be passed multiple times.") f.StringArrayVar(&v.Headers, "headers", nil, "Temporal workflow headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times to set multiple Temporal headers. Note: These are workflow headers, not gRPC headers.") f.StringArrayVar(&v.Memo, "memo", nil, "Memo using 'KEY=\"VALUE\"' pairs. Use JSON values.") - f.StringVar(&v.StaticSummary, "static-summary", "", "Static Workflow summary for human consumption in UIs. Uses Temporal Markdown formatting, should be a single line. EXPERIMENTAL.") - f.StringVar(&v.StaticDetails, "static-details", "", "Static Workflow details for human consumption in UIs. Uses Temporal Markdown formatting, may be multiple lines. EXPERIMENTAL.") + f.StringVar(&v.StaticSummary, "static-summary", "", "Static Workflow summary for human consumption in UIs. Uses standard Markdown formatting excluding images, HTML, and script tags, should be a single line. EXPERIMENTAL.") + f.StringVar(&v.StaticDetails, "static-details", "", "Static Workflow details for human consumption in UIs. Uses standard Markdown formatting excluding images, HTML, and script tags, may be multiple lines. EXPERIMENTAL.") f.IntVar(&v.PriorityKey, "priority-key", 0, "Priority key (1-5, lower numbers = higher priority). Tasks in a queue should be processed in close-to-priority-order. Default is 3 when not specified.") f.StringVar(&v.FairnessKey, "fairness-key", "", "Fairness key (max 64 bytes) for proportional task dispatch. Tasks with same key share capacity based on their weight.") f.Float32Var(&v.FairnessWeight, "fairness-weight", 0, "Weight [0.001-1000] for this fairness key. Keys are dispatched proportionally to their weights.") @@ -405,8 +405,8 @@ func (v *ActivityStartOptions) BuildFlags(f *pflag.FlagSet) { f.Var(&v.IdConflictPolicy, "id-conflict-policy", "Policy for handling activity start when an Activity with the same ID is currently running. Accepted values: Fail, UseExisting.") f.StringArrayVar(&v.SearchAttribute, "search-attribute", nil, "Search Attribute in `KEY=VALUE` format. Keys must be identifiers, and values must be JSON values. Can be passed multiple times. See https://docs.temporal.io/visibility.") f.StringArrayVar(&v.Headers, "headers", nil, "Temporal activity headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times.") - f.StringVar(&v.StaticSummary, "static-summary", "", "Static Activity summary for human consumption in UIs. Uses Temporal Markdown formatting. EXPERIMENTAL.") - f.StringVar(&v.StaticDetails, "static-details", "", "Static Activity details for human consumption in UIs. Uses Temporal Markdown formatting. EXPERIMENTAL.") + f.StringVar(&v.StaticSummary, "static-summary", "", "Static Activity summary for human consumption in UIs. Uses standard Markdown formatting excluding images, HTML, and script tags. EXPERIMENTAL.") + f.StringVar(&v.StaticDetails, "static-details", "", "Static Activity details for human consumption in UIs. Uses standard Markdown formatting excluding images, HTML, and script tags. EXPERIMENTAL.") f.IntVar(&v.PriorityKey, "priority-key", 0, "Priority key (1-5, lower = higher priority). Default is 3 when not specified.") f.StringVar(&v.FairnessKey, "fairness-key", "", "Fairness key (max 64 bytes) for proportional task dispatch.") f.Float32Var(&v.FairnessWeight, "fairness-weight", 0, "Weight [0.001-1000] for this fairness key.") @@ -453,7 +453,7 @@ func NewTemporalActivityCommand(cctx *CommandContext, parent *TemporalCommand) * s.Parent = parent s.Command.Use = "activity" s.Command.Short = "Operate on Activity Executions" - s.Command.Long = "Complete, fail, or update an Activity's state or options." + s.Command.Long = "Perform operations on Activity Executions." s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalActivityCancelCommand(cctx, &s).Command) s.Command.AddCommand(&NewTemporalActivityCompleteCommand(cctx, &s).Command) @@ -2567,9 +2567,9 @@ func NewTemporalTaskQueueDescribeCommand(cctx *CommandContext, parent *TemporalT s.Command.Use = "describe [flags]" s.Command.Short = "Show active Workers" if hasHighlighting { - s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A \x1b[1mLastAccessTime\x1b[0m over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue\x1b[0m\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\x1b[0m\n\nThis command provides the following task queue statistics:\n- \x1b[1mApproximateBacklogCount\x1b[0m: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- \x1b[1mApproximateBacklogAge\x1b[0m: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- \x1b[1mTasksAddRate\x1b[0m: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mTasksDispatchRate\x1b[0m: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mBacklogIncreaseRate\x1b[0m: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n \x1b[1mTasksAddRate\x1b[0m - \x1b[1mTasksDispatchRate\x1b[0m.\n\nNOTE: The \x1b[1mTasksAddRate\x1b[0m and \x1b[1mTasksDispatchRate\x1b[0m metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of \x1b[1mBacklogIncreaseRate\x1b[0m is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag \x1b[1m--report-reachability\x1b[0m:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\x1b[0m\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed \nin a future release. Also, determining task reachability incurs a non-trivial \ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- \x1b[1mReachable\x1b[0m: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- \x1b[1mClosedWorkflowsOnly\x1b[0m: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- \x1b[1mUnreachable\x1b[0m: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, \x1b[1mReachable\x1b[0m is\nmore conservative than \x1b[1mClosedWorkflowsOnly\x1b[0m." + s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A \x1b[1mLastAccessTime\x1b[0m over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue\x1b[0m\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\x1b[0m\n\nThis command provides the following task queue statistics:\n- \x1b[1mApproximateBacklogCount\x1b[0m: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- \x1b[1mApproximateBacklogAge\x1b[0m: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- \x1b[1mTasksAddRate\x1b[0m: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mTasksDispatchRate\x1b[0m: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- \x1b[1mBacklogIncreaseRate\x1b[0m: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n \x1b[1mTasksAddRate\x1b[0m - \x1b[1mTasksDispatchRate\x1b[0m.\n\nNOTE: The \x1b[1mTasksAddRate\x1b[0m and \x1b[1mTasksDispatchRate\x1b[0m metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of \x1b[1mBacklogIncreaseRate\x1b[0m is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag \x1b[1m--report-reachability\x1b[0m:\n\n\x1b[1mtemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\x1b[0m\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed\nin a future release. Also, determining task reachability incurs a non-trivial\ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- \x1b[1mReachable\x1b[0m: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- \x1b[1mClosedWorkflowsOnly\x1b[0m: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- \x1b[1mUnreachable\x1b[0m: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, \x1b[1mReachable\x1b[0m is\nmore conservative than \x1b[1mClosedWorkflowsOnly\x1b[0m." } else { - s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A `LastAccessTime` over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue\n```\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\n```\n\nThis command provides the following task queue statistics:\n- `ApproximateBacklogCount`: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- `ApproximateBacklogAge`: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- `TasksAddRate`: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `TasksDispatchRate`: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `BacklogIncreaseRate`: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n `TasksAddRate` - `TasksDispatchRate`.\n\nNOTE: The `TasksAddRate` and `TasksDispatchRate` metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of `BacklogIncreaseRate` is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag `--report-reachability`:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\n```\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed \nin a future release. Also, determining task reachability incurs a non-trivial \ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- `Reachable`: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- `ClosedWorkflowsOnly`: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- `Unreachable`: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, `Reachable` is\nmore conservative than `ClosedWorkflowsOnly`." + s.Command.Long = "Display a list of active Workers that have recently polled a Task Queue. The\nTemporal Server records each poll request time. A `LastAccessTime` over one\nminute may indicate the Worker is at capacity or has shut down. Temporal\nWorkers are removed if 5 minutes have passed since the last poll request.\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue\n```\n\nThis command provides poller information for a given Task Queue.\nWorkflow and Activity polling use separate Task Queues:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --task-queue-type \"activity\"\n```\n\nThis command provides the following task queue statistics:\n- `ApproximateBacklogCount`: The approximate number of tasks backlogged in this\n task queue. May count expired tasks but eventually converges to the right\n value.\n- `ApproximateBacklogAge`: Approximate age of the oldest task in the backlog,\n based on its creation time, measured in seconds.\n- `TasksAddRate`: Approximate rate at which tasks are being added to the task\n queue, measured in tasks per second, averaged over the last 30 seconds.\n Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `TasksDispatchRate`: Approximate rate at which tasks are being dispatched from\n the task queue, measured in tasks per second, averaged over the last 30\n seconds. Includes tasks dispatched immediately without going to the backlog\n (sync-matched tasks), as well as tasks added to the backlog. (See note below.)\n- `BacklogIncreaseRate`: Approximate rate at which the backlog size is\n increasing (if positive) or decreasing (if negative), measured in tasks per\n second, averaged over the last 30 seconds. This is roughly equivalent to:\n `TasksAddRate` - `TasksDispatchRate`.\n\nNOTE: The `TasksAddRate` and `TasksDispatchRate` metrics may differ from the\nactual rate of add/dispatch, because tasks may be dispatched eagerly to an\navailable worker, or may apply only to specific workers (they are \"sticky\").\nSuch tasks are not counted by these metrics. Despite the inaccuracy of\nthese two metrics, the derived metric of `BacklogIncreaseRate` is accurate\nfor backlogs older than a few seconds.\n\nSafely retire Workers assigned a Build ID by checking reachability across\nall task types. Use the flag `--report-reachability`:\n\n```\ntemporal task-queue describe \\\n --task-queue YourTaskQueue \\\n --select-build-id \"YourBuildId\" \\\n --report-reachability\n```\n\nTask reachability information is returned for the requested versions and all\ntask types, which can be used to safely retire Workers with old code versions,\nprovided that they were assigned a Build ID.\n\nNote that task reachability status is deprecated in favor of Drainage Status\n(ie. of a Drained or Draining Worker Deployment Version) and will be removed\nin a future release. Also, determining task reachability incurs a non-trivial\ncomputing cost.\n\nTask reachability states are reported per build ID. The state may be one of the\nfollowing:\n\n- `Reachable`: using the current versioning rules, the Build ID may be used\n by new Workflow Executions or Activities OR there are currently open\n Workflow or backlogged Activity tasks assigned to the queue.\n- `ClosedWorkflowsOnly`: the Build ID does not have open Workflow Executions\n and can't be reached by new Workflow Executions. It MAY have closed\n Workflow Executions within the Namespace retention period.\n- `Unreachable`: this Build ID is not used for new Workflow Executions and\n isn't used by any existing Workflow Execution within the retention period.\n\nTask reachability is eventually consistent. You may experience a delay until\nreachability converges to the most accurate value. This is designed to act\nin the most conservative way until convergence. For example, `Reachable` is\nmore conservative than `ClosedWorkflowsOnly`." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVarP(&s.TaskQueue, "task-queue", "t", "", "Task Queue name. Required.") @@ -3322,9 +3322,9 @@ func NewTemporalWorkerDeploymentManagerIdentityCommand(cctx *CommandContext, par s.Command.Use = "manager-identity" s.Command.Short = "Manager Identity commands change the `ManagerIdentity` of a Worker Deployment" if hasHighlighting { - s.Command.Long = "Manager Identity commands change the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment:\n\n\x1b[1mtemporal worker deployment manager-identity [command] [options]\x1b[0m\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with \x1b[1mdescribe\x1b[0m:\n\x1b[1m temporal worker deployment describe \\\n --deployment-name YourDeploymentName\x1b[0m" + s.Command.Long = "Manager Identity commands change the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment:\n\n\x1b[1mtemporal worker deployment manager-identity [command] [options]\x1b[0m\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with \x1b[1mdescribe\x1b[0m:\n\x1b[1m temporal worker deployment describe \\\n --deployment-name YourDeploymentName\x1b[0m" } else { - s.Command.Long = "Manager Identity commands change the `ManagerIdentity` of a Worker Deployment:\n\n```\ntemporal worker deployment manager-identity [command] [options]\n```\n\nWhen present, `ManagerIdentity` is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with `describe`:\n```\n temporal worker deployment describe \\\n --deployment-name YourDeploymentName\n```" + s.Command.Long = "Manager Identity commands change the `ManagerIdentity` of a Worker Deployment:\n\n```\ntemporal worker deployment manager-identity [command] [options]\n```\n\nWhen present, `ManagerIdentity` is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\nThe current Manager Identity is returned with `describe`:\n```\n temporal worker deployment describe \\\n --deployment-name YourDeploymentName\n```" } s.Command.Args = cobra.NoArgs s.Command.AddCommand(&NewTemporalWorkerDeploymentManagerIdentitySetCommand(cctx, &s).Command) @@ -3348,9 +3348,9 @@ func NewTemporalWorkerDeploymentManagerIdentitySetCommand(cctx *CommandContext, s.Command.Use = "set [flags]" s.Command.Short = "Set the Manager Identity of a Worker Deployment" if hasHighlighting { - s.Command.Long = "Set the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity set [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\x1b[0m\n\nSets the Manager Identity of the Deployment to the identity of the user making \nthis request. If you don't specifically pass an identity field, the CLI will \ngenerate your identity for you.\n\nFor example:\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\x1b[0m\n\nSets the Manager Identity of the Deployment to any string." + s.Command.Long = "Set the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity set [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\x1b[0m\n\nSets the Manager Identity of the Deployment to the identity of the user making\nthis request. If you don't specifically pass an identity field, the CLI will\ngenerate your identity for you.\n\nFor example:\n\x1b[1mtemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\x1b[0m\n\nSets the Manager Identity of the Deployment to any string." } else { - s.Command.Long = "Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity set [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\n```\n\nSets the Manager Identity of the Deployment to the identity of the user making \nthis request. If you don't specifically pass an identity field, the CLI will \ngenerate your identity for you.\n\nFor example:\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\n```\n\nSets the Manager Identity of the Deployment to any string." + s.Command.Long = "Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity set [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --self \\\n --identity YourUserIdentity # optional, populated by CLI if not provided\n```\n\nSets the Manager Identity of the Deployment to the identity of the user making\nthis request. If you don't specifically pass an identity field, the CLI will\ngenerate your identity for you.\n\nFor example:\n```\ntemporal worker deployment manager-identity set \\\n --deployment-name DeploymentName \\\n --manager-identity NewManagerIdentity\n```\n\nSets the Manager Identity of the Deployment to any string." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.ManagerIdentity, "manager-identity", "", "New Manager Identity. Required unless --self is specified.") @@ -3379,9 +3379,9 @@ func NewTemporalWorkerDeploymentManagerIdentityUnsetCommand(cctx *CommandContext s.Command.Use = "unset [flags]" s.Command.Short = "Unset the Manager Identity of a Worker Deployment" if hasHighlighting { - s.Command.Long = "Unset the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity unset [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\x1b[0m\n\nClears the Manager Identity field for a given Deployment." + s.Command.Long = "Unset the \x1b[1mManagerIdentity\x1b[0m of a Worker Deployment given its Deployment Name.\n\nWhen present, \x1b[1mManagerIdentity\x1b[0m is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the \x1b[1mManagerIdentity\x1b[0m will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n\x1b[1mManagerIdentity\x1b[0m allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n\x1b[1mtemporal worker deployment manager-identity unset [options]\x1b[0m\n\nFor example:\n\n\x1b[1mtemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\x1b[0m\n\nClears the Manager Identity field for a given Deployment." } else { - s.Command.Long = "Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the \nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity unset [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\n```\n\nClears the Manager Identity field for a given Deployment." + s.Command.Long = "Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name.\n\nWhen present, `ManagerIdentity` is the identity of the user that has the\nexclusive right to make changes to this Worker Deployment. Empty by default.\nWhen set, users whose identity does not match the `ManagerIdentity` will not\nbe able to change the Worker Deployment.\n\nThis is especially useful in environments where multiple users (such as CLI\nusers and automated controllers) may interact with the same Worker Deployment.\n`ManagerIdentity` allows different users to communicate with one another about\nwho is expected to make changes to the Worker Deployment.\n\n```\ntemporal worker deployment manager-identity unset [options]\n```\n\nFor example:\n\n```\ntemporal worker deployment manager-identity unset \\\n --deployment-name YourDeploymentName\n```\n\nClears the Manager Identity field for a given Deployment." } s.Command.Args = cobra.NoArgs s.Command.Flags().StringVar(&s.DeploymentName, "deployment-name", "", "Name for a Worker Deployment. Required.") diff --git a/internal/temporalcli/commands.yaml b/internal/temporalcli/commands.yaml index f5886e84d..7ca376ef1 100644 --- a/internal/temporalcli/commands.yaml +++ b/internal/temporalcli/commands.yaml @@ -148,7 +148,7 @@ commands: - name: temporal activity summary: Operate on Activity Executions description: | - Complete, fail, or update an Activity's state or options. + Perform operations on Activity Executions. option-sets: - client docs: @@ -1264,17 +1264,17 @@ commands: ``` temporal worker deployment manager-identity [command] [options] ``` - - When present, `ManagerIdentity` is the identity of the user that has the + + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. - + This is especially useful in environments where multiple users (such as CLI users and automated controllers) may interact with the same Worker Deployment. `ManagerIdentity` allows different users to communicate with one another about who is expected to make changes to the Worker Deployment. - + The current Manager Identity is returned with `describe`: ``` temporal worker deployment describe \ @@ -1293,12 +1293,12 @@ commands: summary: Set the Manager Identity of a Worker Deployment description: | Set the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - - When present, `ManagerIdentity` is the identity of the user that has the + + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. - + This is especially useful in environments where multiple users (such as CLI users and automated controllers) may interact with the same Worker Deployment. `ManagerIdentity` allows different users to communicate with one another about @@ -1307,7 +1307,7 @@ commands: ``` temporal worker deployment manager-identity set [options] ``` - + For example: ``` @@ -1317,17 +1317,17 @@ commands: --identity YourUserIdentity # optional, populated by CLI if not provided ``` - Sets the Manager Identity of the Deployment to the identity of the user making - this request. If you don't specifically pass an identity field, the CLI will + Sets the Manager Identity of the Deployment to the identity of the user making + this request. If you don't specifically pass an identity field, the CLI will generate your identity for you. - + For example: ``` temporal worker deployment manager-identity set \ --deployment-name DeploymentName \ --manager-identity NewManagerIdentity ``` - + Sets the Manager Identity of the Deployment to any string. options: @@ -1349,12 +1349,12 @@ commands: summary: Unset the Manager Identity of a Worker Deployment description: | Unset the `ManagerIdentity` of a Worker Deployment given its Deployment Name. - - When present, `ManagerIdentity` is the identity of the user that has the + + When present, `ManagerIdentity` is the identity of the user that has the exclusive right to make changes to this Worker Deployment. Empty by default. When set, users whose identity does not match the `ManagerIdentity` will not be able to change the Worker Deployment. - + This is especially useful in environments where multiple users (such as CLI users and automated controllers) may interact with the same Worker Deployment. `ManagerIdentity` allows different users to communicate with one another about @@ -1363,7 +1363,7 @@ commands: ``` temporal worker deployment manager-identity unset [options] ``` - + For example: ``` @@ -1386,7 +1386,7 @@ commands: summary: List worker status information in a specific namespace (EXPERIMENTAL) description: | Get a list of workers to the specified namespace. - + ``` temporal worker list --namespace YourNamespace --query 'TaskQueue="YourTaskQueue"' ``` @@ -1403,7 +1403,7 @@ commands: summary: Returns information about a specific worker (EXPERIMENTAL) description: | Look up information of a specific worker. - + ``` temporal worker describe --namespace YourNamespace --worker-instance-key YourKey ``` @@ -2687,8 +2687,8 @@ commands: provided that they were assigned a Build ID. Note that task reachability status is deprecated in favor of Drainage Status - (ie. of a Drained or Draining Worker Deployment Version) and will be removed - in a future release. Also, determining task reachability incurs a non-trivial + (ie. of a Drained or Draining Worker Deployment Version) and will be removed + in a future release. Also, determining task reachability incurs a non-trivial computing cost. Task reachability states are reported per build ID. The state may be one of the @@ -4695,13 +4695,13 @@ option-sets: experimental: true description: | Static Workflow summary for human consumption in UIs. - Uses Temporal Markdown formatting, should be a single line. + Uses standard Markdown formatting excluding images, HTML, and script tags, should be a single line. - name: static-details type: string experimental: true description: | Static Workflow details for human consumption in UIs. - Uses Temporal Markdown formatting, may be multiple lines. + Uses standard Markdown formatting excluding images, HTML, and script tags, may be multiple lines. - name: priority-key type: int description: | @@ -4888,7 +4888,7 @@ option-sets: Temporal workflow headers in 'KEY=VALUE' format. Keys must be identifiers, and values must be JSON values. May be passed multiple times to set multiple Temporal headers. - Note: These are workflow headers, not gRPC headers. + Note: These are workflow headers, not gRPC headers. - name: workflow-update-options options: @@ -5020,13 +5020,13 @@ option-sets: experimental: true description: | Static Activity summary for human consumption in UIs. - Uses Temporal Markdown formatting. + Uses standard Markdown formatting excluding images, HTML, and script tags. - name: static-details type: string experimental: true description: | Static Activity details for human consumption in UIs. - Uses Temporal Markdown formatting. + Uses standard Markdown formatting excluding images, HTML, and script tags. - name: priority-key type: int description: | From 67942e7cf9253744b73c643b8387ddfc6fcbe8ad Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 20:13:20 -0500 Subject: [PATCH 25/30] Fix test to assert JSON output instead of Go %v format The test was asserting map[foo:bar] which is Go's internal format. The expected output is JSON: {"foo":"bar"}. --- internal/temporalcli/commands.activity_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/temporalcli/commands.activity_test.go b/internal/temporalcli/commands.activity_test.go index 5beb51ca7..70f60a05c 100644 --- a/internal/temporalcli/commands.activity_test.go +++ b/internal/temporalcli/commands.activity_test.go @@ -593,7 +593,7 @@ func (s *SharedServerSuite) TestStandaloneActivity_Execute_Success() { "--address", s.Address(), ) s.NoError(res.Err) - s.ContainsOnSameLine(res.Stdout.String(), "Result", `map[foo:bar]`) + s.ContainsOnSameLine(res.Stdout.String(), "Result", `{"foo":"bar"}`) } func (s *SharedServerSuite) TestStandaloneActivity_Execute_Failure() { From 15c1f96e0fc99215d13b7af851669d2e4db4e2e7 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 20:13:26 -0500 Subject: [PATCH 26/30] Use JSON output for activity result instead of Go %v format printActivityOutcome now JSON-marshals values so complex types (maps, slices) render as JSON rather than Go's fmt representation. --- internal/temporalcli/commands.activity.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/temporalcli/commands.activity.go b/internal/temporalcli/commands.activity.go index ed30d01b5..22a849cca 100644 --- a/internal/temporalcli/commands.activity.go +++ b/internal/temporalcli/commands.activity.go @@ -2,6 +2,7 @@ package temporalcli import ( "context" + "encoding/json" "fmt" "time" @@ -796,7 +797,12 @@ func printActivityOutcome(cctx *CommandContext, outcome *activitypb.ActivityExec if err := converter.GetDefaultDataConverter().FromPayload(payload, &value); err != nil { cctx.Printer.Printlnf("Result: ", err) } else { - cctx.Printer.Printlnf("Result: %v", value) + jsonBytes, err := json.Marshal(value) + if err != nil { + cctx.Printer.Printlnf("Result: ", err) + } else { + cctx.Printer.Printlnf("Result: %s", jsonBytes) + } } } return nil From 813093fd30119fd4a22ad9995e75f8e6620a6f72 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 20:28:29 -0500 Subject: [PATCH 27/30] Add test coverage for standalone activity complete and fail Tests verify that `activity complete` and `activity fail` work for standalone activities (without --workflow-id, using --run-id). --- .../temporalcli/commands.activity_test.go | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/internal/temporalcli/commands.activity_test.go b/internal/temporalcli/commands.activity_test.go index 70f60a05c..d09480cb4 100644 --- a/internal/temporalcli/commands.activity_test.go +++ b/internal/temporalcli/commands.activity_test.go @@ -522,6 +522,48 @@ func (s *SharedServerSuite) TestResetActivity_BatchSuccess() { failActivity.Store(false) } +func (s *SharedServerSuite) TestStandaloneActivity_Complete() { + activityStarted := make(chan struct{}) + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + close(activityStarted) + <-ctx.Done() + return nil, ctx.Err() + }) + + started := s.startStandaloneActivity("sa-complete-test") + <-activityStarted + + res := s.Execute( + "activity", "complete", + "--activity-id", "sa-complete-test", + "--run-id", started["runId"].(string), + "--result", `"completed-externally"`, + "--address", s.Address(), + ) + s.NoError(res.Err) +} + +func (s *SharedServerSuite) TestStandaloneActivity_Fail() { + activityStarted := make(chan struct{}) + s.Worker().OnDevActivity(func(ctx context.Context, a any) (any, error) { + close(activityStarted) + <-ctx.Done() + return nil, ctx.Err() + }) + + started := s.startStandaloneActivity("sa-fail-test") + <-activityStarted + + res := s.Execute( + "activity", "fail", + "--activity-id", "sa-fail-test", + "--run-id", started["runId"].(string), + "--reason", "external-failure", + "--address", s.Address(), + ) + s.NoError(res.Err) +} + // startStandaloneActivity starts a standalone activity via the CLI and returns // the parsed JSON response containing activityId and runId. func (s *SharedServerSuite) startStandaloneActivity(activityID string, extraArgs ...string) map[string]any { From 9bfd8abc382f668e13e7a87f3a218f99f9d35dcc Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 20:58:16 -0500 Subject: [PATCH 28/30] Relocate Result command --- internal/temporalcli/commands.activity.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/temporalcli/commands.activity.go b/internal/temporalcli/commands.activity.go index 22a849cca..4ff441ccc 100644 --- a/internal/temporalcli/commands.activity.go +++ b/internal/temporalcli/commands.activity.go @@ -475,6 +475,16 @@ func (c *TemporalActivityExecuteCommand) run(cctx *CommandContext, args []string return pollActivityOutcome(cctx, cl.WorkflowService(), c.Parent.Namespace, c.ActivityId, startResp.RunId) } +func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + return pollActivityOutcome(cctx, cl.WorkflowService(), c.Parent.Namespace, c.ActivityId, c.RunId) +} + func (c *TemporalActivityDescribeCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { @@ -638,16 +648,6 @@ func (c *TemporalActivityTerminateCommand) run(cctx *CommandContext, args []stri return nil } -func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) error { - cl, err := dialClient(cctx, &c.Parent.ClientOptions) - if err != nil { - return err - } - defer cl.Close() - - return pollActivityOutcome(cctx, cl.WorkflowService(), c.Parent.Namespace, c.ActivityId, c.RunId) -} - func pollActivityOutcome(cctx *CommandContext, svc workflowservice.WorkflowServiceClient, ns, activityID, runID string) error { req := &workflowservice.PollActivityExecutionRequest{ Namespace: ns, From 9d569ae54c8584e53eab966329531d8252ae9c7e Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 21:15:49 -0500 Subject: [PATCH 29/30] Use SDK ActivityHandle for activity result polling Replace hand-rolled PollActivityExecution long poll loop with the SDK's client.GetActivityHandle().Get(), which provides proper gRPC long-poll handling and retry semantics. This is analogous to how workflow update uses UpdateWorkflow() + updateHandle.Get(). --- internal/temporalcli/commands.activity.go | 75 ++++++++--------------- 1 file changed, 24 insertions(+), 51 deletions(-) diff --git a/internal/temporalcli/commands.activity.go b/internal/temporalcli/commands.activity.go index 4ff441ccc..89e29a424 100644 --- a/internal/temporalcli/commands.activity.go +++ b/internal/temporalcli/commands.activity.go @@ -1,7 +1,6 @@ package temporalcli import ( - "context" "encoding/json" "fmt" "time" @@ -16,6 +15,7 @@ import ( sdkpb "go.temporal.io/api/sdk/v1" taskqueuepb "go.temporal.io/api/taskqueue/v1" "go.temporal.io/api/workflowservice/v1" + "go.temporal.io/sdk/client" "go.temporal.io/sdk/converter" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/fieldmaskpb" @@ -472,7 +472,7 @@ func (c *TemporalActivityExecuteCommand) run(cctx *CommandContext, args []string if err != nil { return fmt.Errorf("failed starting activity: %w", err) } - return pollActivityOutcome(cctx, cl.WorkflowService(), c.Parent.Namespace, c.ActivityId, startResp.RunId) + return getActivityResult(cctx, cl, c.ActivityId, startResp.RunId) } func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) error { @@ -482,7 +482,7 @@ func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) } defer cl.Close() - return pollActivityOutcome(cctx, cl.WorkflowService(), c.Parent.Namespace, c.ActivityId, c.RunId) + return getActivityResult(cctx, cl, c.ActivityId, c.RunId) } func (c *TemporalActivityDescribeCommand) run(cctx *CommandContext, args []string) error { @@ -648,30 +648,30 @@ func (c *TemporalActivityTerminateCommand) run(cctx *CommandContext, args []stri return nil } -func pollActivityOutcome(cctx *CommandContext, svc workflowservice.WorkflowServiceClient, ns, activityID, runID string) error { - req := &workflowservice.PollActivityExecutionRequest{ - Namespace: ns, - ActivityId: activityID, - RunId: runID, - } - var resp *workflowservice.PollActivityExecutionResponse - for resp.GetOutcome() == nil { - rpcCtx, cancel := context.WithTimeout(cctx, longPollPerRPCTimeout) - var err error - resp, err = svc.PollActivityExecution(rpcCtx, req) - cancel() - if err != nil { - if cctx.Err() != nil { - return cctx.Err() - } - return fmt.Errorf("failed polling activity result: %w", err) - } +func getActivityResult(cctx *CommandContext, cl client.Client, activityID, runID string) error { + handle := cl.GetActivityHandle(client.GetActivityHandleOptions{ + ActivityID: activityID, + RunID: runID, + }) + var valuePtr interface{} + if err := handle.Get(cctx, &valuePtr); err != nil { + return fmt.Errorf("activity failed: %w", err) + } + if cctx.JSONOutput { + return cctx.Printer.PrintStructured( + struct { + Result interface{} `json:"result"` + }{Result: valuePtr}, + printer.StructuredOptions{}) + } + jsonBytes, err := json.Marshal(valuePtr) + if err != nil { + return fmt.Errorf("failed marshaling result: %w", err) } - return printActivityOutcome(cctx, resp.GetOutcome()) + cctx.Printer.Printlnf("Result: %s", jsonBytes) + return nil } -const longPollPerRPCTimeout = 70 * time.Second - func buildStartActivityRequest( cctx *CommandContext, parent *TemporalActivityCommand, @@ -785,30 +785,3 @@ func buildStartActivityRequest( return req, nil } - -func printActivityOutcome(cctx *CommandContext, outcome *activitypb.ActivityExecutionOutcome) error { - if cctx.JSONOutput { - return cctx.Printer.PrintStructured(outcome, printer.StructuredOptions{}) - } - switch v := outcome.GetValue().(type) { - case *activitypb.ActivityExecutionOutcome_Result: - for _, payload := range v.Result.Payloads { - var value any - if err := converter.GetDefaultDataConverter().FromPayload(payload, &value); err != nil { - cctx.Printer.Printlnf("Result: ", err) - } else { - jsonBytes, err := json.Marshal(value) - if err != nil { - cctx.Printer.Printlnf("Result: ", err) - } else { - cctx.Printer.Printlnf("Result: %s", jsonBytes) - } - } - } - return nil - case *activitypb.ActivityExecutionOutcome_Failure: - return fmt.Errorf("activity failed: %s", v.Failure.GetMessage()) - default: - return fmt.Errorf("unexpected activity outcome type: %T", v) - } -} From 990e6df31c8ea71a386512e0cf21e8530f7de018 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 19 Feb 2026 21:22:59 -0500 Subject: [PATCH 30/30] Relocate --- internal/temporalcli/commands.activity.go | 1090 ++++++++++----------- 1 file changed, 545 insertions(+), 545 deletions(-) diff --git a/internal/temporalcli/commands.activity.go b/internal/temporalcli/commands.activity.go index 89e29a424..09b31e48a 100644 --- a/internal/temporalcli/commands.activity.go +++ b/internal/temporalcli/commands.activity.go @@ -37,751 +37,751 @@ type ( } ) -func (c *TemporalActivityCompleteCommand) run(cctx *CommandContext, args []string) error { +func (c *TemporalActivityStartCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - metadata := map[string][][]byte{"encoding": {[]byte("json/plain")}} - resultPayloads, err := CreatePayloads([][]byte{[]byte(c.Result)}, metadata, false) + req, err := buildStartActivityRequest(cctx, c.Parent, &c.ActivityStartOptions, &c.PayloadInputOptions) if err != nil { return err } - - _, err = cl.WorkflowService().RespondActivityTaskCompletedById(cctx, &workflowservice.RespondActivityTaskCompletedByIdRequest{ - Namespace: c.Parent.Namespace, - WorkflowId: c.WorkflowId, - RunId: c.RunId, - ActivityId: c.ActivityId, - Result: resultPayloads, - Identity: c.Parent.Identity, - }) + resp, err := cl.WorkflowService().StartActivityExecution(cctx, req) if err != nil { - return fmt.Errorf("unable to complete Activity: %w", err) + return fmt.Errorf("failed starting activity: %w", err) } - return nil + return cctx.Printer.PrintStructured(struct { + ActivityId string `json:"activityId"` + RunId string `json:"runId"` + Started bool `json:"started"` + }{ + ActivityId: c.ActivityId, + RunId: resp.RunId, + Started: resp.Started, + }, printer.StructuredOptions{}) } -func (c *TemporalActivityFailCommand) run(cctx *CommandContext, args []string) error { +func (c *TemporalActivityExecuteCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - var detailPayloads *common.Payloads - if len(c.Detail) > 0 { - metadata := map[string][][]byte{"encoding": {[]byte("json/plain")}} - detailPayloads, err = CreatePayloads([][]byte{[]byte(c.Detail)}, metadata, false) - if err != nil { - return err - } + req, err := buildStartActivityRequest(cctx, c.Parent, &c.ActivityStartOptions, &c.PayloadInputOptions) + if err != nil { + return err } - _, err = cl.WorkflowService().RespondActivityTaskFailedById(cctx, &workflowservice.RespondActivityTaskFailedByIdRequest{ - Namespace: c.Parent.Namespace, - WorkflowId: c.WorkflowId, - RunId: c.RunId, - ActivityId: c.ActivityId, - Failure: &failure.Failure{ - Message: c.Reason, - Source: "CLI", - FailureInfo: &failure.Failure_ApplicationFailureInfo{ApplicationFailureInfo: &failure.ApplicationFailureInfo{ - NonRetryable: true, - Details: detailPayloads, - }}, - }, - Identity: c.Parent.Identity, - }) + startResp, err := cl.WorkflowService().StartActivityExecution(cctx, req) if err != nil { - return fmt.Errorf("unable to fail Activity: %w", err) + return fmt.Errorf("failed starting activity: %w", err) } - return nil + return getActivityResult(cctx, cl, c.ActivityId, startResp.RunId) } -func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args []string) error { +func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - updatePath := []string{} - activityOptions := &activitypb.ActivityOptions{} + return getActivityResult(cctx, cl, c.ActivityId, c.RunId) +} - if c.Command.Flags().Changed("task-queue") { - activityOptions.TaskQueue = &taskqueuepb.TaskQueue{Name: c.TaskQueue} - updatePath = append(updatePath, "task_queue_name") +func buildStartActivityRequest( + cctx *CommandContext, + parent *TemporalActivityCommand, + opts *ActivityStartOptions, + inputOpts *PayloadInputOptions, +) (*workflowservice.StartActivityExecutionRequest, error) { + input, err := inputOpts.buildRawInputPayloads() + if err != nil { + return nil, err } - if c.Command.Flags().Changed("schedule-to-close-timeout") { - activityOptions.ScheduleToCloseTimeout = durationpb.New(c.ScheduleToCloseTimeout.Duration()) - updatePath = append(updatePath, "schedule_to_close_timeout") + req := &workflowservice.StartActivityExecutionRequest{ + Namespace: parent.Namespace, + Identity: parent.Identity, + RequestId: uuid.New().String(), + ActivityId: opts.ActivityId, + ActivityType: &common.ActivityType{ + Name: opts.Type, + }, + TaskQueue: &taskqueuepb.TaskQueue{ + Name: opts.TaskQueue, + }, + ScheduleToCloseTimeout: durationpb.New(opts.ScheduleToCloseTimeout.Duration()), + ScheduleToStartTimeout: durationpb.New(opts.ScheduleToStartTimeout.Duration()), + StartToCloseTimeout: durationpb.New(opts.StartToCloseTimeout.Duration()), + HeartbeatTimeout: durationpb.New(opts.HeartbeatTimeout.Duration()), + Input: input, } - if c.Command.Flags().Changed("schedule-to-start-timeout") { - activityOptions.ScheduleToStartTimeout = durationpb.New(c.ScheduleToStartTimeout.Duration()) - updatePath = append(updatePath, "schedule_to_start_timeout") + if opts.RetryInitialInterval.Duration() > 0 || opts.RetryMaximumInterval.Duration() > 0 || + opts.RetryBackoffCoefficient > 0 || opts.RetryMaximumAttempts > 0 { + req.RetryPolicy = &common.RetryPolicy{} + if opts.RetryInitialInterval.Duration() > 0 { + req.RetryPolicy.InitialInterval = durationpb.New(opts.RetryInitialInterval.Duration()) + } + if opts.RetryMaximumInterval.Duration() > 0 { + req.RetryPolicy.MaximumInterval = durationpb.New(opts.RetryMaximumInterval.Duration()) + } + if opts.RetryBackoffCoefficient > 0 { + req.RetryPolicy.BackoffCoefficient = float64(opts.RetryBackoffCoefficient) + } + if opts.RetryMaximumAttempts > 0 { + req.RetryPolicy.MaximumAttempts = int32(opts.RetryMaximumAttempts) + } } - if c.Command.Flags().Changed("start-to-close-timeout") { - activityOptions.StartToCloseTimeout = durationpb.New(c.StartToCloseTimeout.Duration()) - updatePath = append(updatePath, "start_to_close_timeout") + if opts.IdReusePolicy.Value != "" { + v, err := stringToProtoEnum[enumspb.ActivityIdReusePolicy]( + opts.IdReusePolicy.Value, enumspb.ActivityIdReusePolicy_shorthandValue, enumspb.ActivityIdReusePolicy_value) + if err != nil { + return nil, fmt.Errorf("invalid activity ID reuse policy: %w", err) + } + req.IdReusePolicy = v + } + if opts.IdConflictPolicy.Value != "" { + v, err := stringToProtoEnum[enumspb.ActivityIdConflictPolicy]( + opts.IdConflictPolicy.Value, enumspb.ActivityIdConflictPolicy_shorthandValue, enumspb.ActivityIdConflictPolicy_value) + if err != nil { + return nil, fmt.Errorf("invalid activity ID conflict policy: %w", err) + } + req.IdConflictPolicy = v } - if c.Command.Flags().Changed("heartbeat-timeout") { - activityOptions.HeartbeatTimeout = durationpb.New(c.HeartbeatTimeout.Duration()) - updatePath = append(updatePath, "heartbeat_timeout") + if len(opts.SearchAttribute) > 0 { + saMap, err := stringKeysJSONValues(opts.SearchAttribute, false) + if err != nil { + return nil, fmt.Errorf("invalid search attribute values: %w", err) + } + saPayloads, err := encodeMapToPayloads(saMap) + if err != nil { + return nil, fmt.Errorf("failed encoding search attributes: %w", err) + } + req.SearchAttributes = &common.SearchAttributes{IndexedFields: saPayloads} } - if c.Command.Flags().Changed("retry-initial-interval") || - c.Command.Flags().Changed("retry-maximum-interval") || - c.Command.Flags().Changed("retry-backoff-coefficient") || - c.Command.Flags().Changed("retry-maximum-attempts") { - activityOptions.RetryPolicy = &common.RetryPolicy{} + if len(opts.Headers) > 0 { + headerMap, err := stringKeysJSONValues(opts.Headers, false) + if err != nil { + return nil, fmt.Errorf("invalid header values: %w", err) + } + headerPayloads, err := encodeMapToPayloads(headerMap) + if err != nil { + return nil, fmt.Errorf("failed encoding headers: %w", err) + } + req.Header = &common.Header{Fields: headerPayloads} } - if c.Command.Flags().Changed("retry-initial-interval") { - activityOptions.RetryPolicy.InitialInterval = durationpb.New(c.RetryInitialInterval.Duration()) - updatePath = append(updatePath, "retry_policy.initial_interval") + if opts.StaticSummary != "" || opts.StaticDetails != "" { + req.UserMetadata = &sdkpb.UserMetadata{} + if opts.StaticSummary != "" { + req.UserMetadata.Summary = &common.Payload{ + Metadata: map[string][]byte{"encoding": []byte("json/plain")}, + Data: []byte(fmt.Sprintf("%q", opts.StaticSummary)), + } + } + if opts.StaticDetails != "" { + req.UserMetadata.Details = &common.Payload{ + Metadata: map[string][]byte{"encoding": []byte("json/plain")}, + Data: []byte(fmt.Sprintf("%q", opts.StaticDetails)), + } + } } - if c.Command.Flags().Changed("retry-maximum-interval") { - activityOptions.RetryPolicy.MaximumInterval = durationpb.New(c.RetryMaximumInterval.Duration()) - updatePath = append(updatePath, "retry_policy.maximum_interval") + if opts.PriorityKey > 0 || opts.FairnessKey != "" || opts.FairnessWeight > 0 { + req.Priority = &common.Priority{ + PriorityKey: int32(opts.PriorityKey), + FairnessKey: opts.FairnessKey, + FairnessWeight: float32(opts.FairnessWeight), + } } - if c.Command.Flags().Changed("retry-backoff-coefficient") { - activityOptions.RetryPolicy.BackoffCoefficient = float64(c.RetryBackoffCoefficient) - updatePath = append(updatePath, "retry_policy.backoff_coefficient") + return req, nil +} + +func getActivityResult(cctx *CommandContext, cl client.Client, activityID, runID string) error { + handle := cl.GetActivityHandle(client.GetActivityHandleOptions{ + ActivityID: activityID, + RunID: runID, + }) + var valuePtr interface{} + if err := handle.Get(cctx, &valuePtr); err != nil { + return fmt.Errorf("activity failed: %w", err) + } + if cctx.JSONOutput { + return cctx.Printer.PrintStructured( + struct { + Result interface{} `json:"result"` + }{Result: valuePtr}, + printer.StructuredOptions{}) + } + jsonBytes, err := json.Marshal(valuePtr) + if err != nil { + return fmt.Errorf("failed marshaling result: %w", err) } + cctx.Printer.Printlnf("Result: %s", jsonBytes) + return nil +} - if c.Command.Flags().Changed("retry-maximum-attempts") { - activityOptions.RetryPolicy.MaximumAttempts = int32(c.RetryMaximumAttempts) - updatePath = append(updatePath, "retry_policy.maximum_attempts") +func (c *TemporalActivityDescribeCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err } + defer cl.Close() - opts := SingleWorkflowOrBatchOptions{ - WorkflowId: c.WorkflowId, - RunId: c.RunId, - Query: c.Query, - Reason: c.Reason, - Yes: c.Yes, - Rps: c.Rps, + resp, err := cl.WorkflowService().DescribeActivityExecution(cctx, &workflowservice.DescribeActivityExecutionRequest{ + Namespace: c.Parent.Namespace, + ActivityId: c.ActivityId, + RunId: c.RunId, + IncludeInput: true, + IncludeOutcome: true, + }) + if err != nil { + return fmt.Errorf("failed describing activity: %w", err) + } + if c.Raw || cctx.JSONOutput { + return cctx.Printer.PrintStructured(resp, printer.StructuredOptions{}) } + return cctx.Printer.PrintStructured(resp.Info, printer.StructuredOptions{}) +} - exec, batchReq, err := opts.workflowExecOrBatch(cctx, c.Parent.Namespace, cl, singleOrBatchOverrides{}) +func (c *TemporalActivityListCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } + defer cl.Close() - if exec != nil { - result, err := cl.WorkflowService().UpdateActivityOptions(cctx, &workflowservice.UpdateActivityOptionsRequest{ - Namespace: c.Parent.Namespace, - Execution: &common.WorkflowExecution{ - WorkflowId: c.WorkflowId, - RunId: c.RunId, - }, - Activity: &workflowservice.UpdateActivityOptionsRequest_Id{Id: c.ActivityId}, - ActivityOptions: activityOptions, - UpdateMask: &fieldmaskpb.FieldMask{ - Paths: updatePath, - }, - Identity: c.Parent.Identity, + cctx.Printer.StartList() + defer cctx.Printer.EndList() + + var nextPageToken []byte + var execsProcessed int + for pageIndex := 0; ; pageIndex++ { + resp, err := cl.WorkflowService().ListActivityExecutions(cctx, &workflowservice.ListActivityExecutionsRequest{ + Namespace: c.Parent.Namespace, + PageSize: int32(c.PageSize), + NextPageToken: nextPageToken, + Query: c.Query, }) if err != nil { - return fmt.Errorf("unable to update Activity options: %w", err) - } - - updatedOptions := updateOptionsDescribe{ - TaskQueue: result.GetActivityOptions().TaskQueue.GetName(), - - ScheduleToCloseTimeout: result.GetActivityOptions().ScheduleToCloseTimeout.AsDuration(), - ScheduleToStartTimeout: result.GetActivityOptions().ScheduleToStartTimeout.AsDuration(), - StartToCloseTimeout: result.GetActivityOptions().StartToCloseTimeout.AsDuration(), - HeartbeatTimeout: result.GetActivityOptions().HeartbeatTimeout.AsDuration(), - - InitialInterval: result.GetActivityOptions().RetryPolicy.InitialInterval.AsDuration(), - BackoffCoefficient: result.GetActivityOptions().RetryPolicy.BackoffCoefficient, - MaximumInterval: result.GetActivityOptions().RetryPolicy.MaximumInterval.AsDuration(), - MaximumAttempts: result.GetActivityOptions().RetryPolicy.MaximumAttempts, - } - - _ = cctx.Printer.PrintStructured(updatedOptions, printer.StructuredOptions{}) - } else { - updateActivitiesOperation := &batch.BatchOperationUpdateActivityOptions{ - Identity: c.Parent.Identity, - Activity: &batch.BatchOperationUpdateActivityOptions_Type{Type: c.ActivityType}, - UpdateMask: &fieldmaskpb.FieldMask{ - Paths: updatePath, - }, - RestoreOriginal: c.RestoreOriginalOptions, + return fmt.Errorf("failed listing activities: %w", err) } - - if c.ActivityType != "" { - updateActivitiesOperation.Activity = &batch.BatchOperationUpdateActivityOptions_Type{Type: c.ActivityType} - } else if c.MatchAll { - updateActivitiesOperation.Activity = &batch.BatchOperationUpdateActivityOptions_MatchAll{MatchAll: true} - } else { - return fmt.Errorf("either Activity Type must be provided or MatchAll must be set to true") + var textTable []map[string]any + for _, exec := range resp.Executions { + if c.Limit > 0 && execsProcessed >= c.Limit { + break + } + execsProcessed++ + if cctx.JSONOutput { + _ = cctx.Printer.PrintStructured(exec, printer.StructuredOptions{}) + } else { + textTable = append(textTable, map[string]any{ + "Status": exec.Status, + "ActivityId": exec.ActivityId, + "Type": exec.ActivityType.GetName(), + "StartTime": exec.ScheduleTime.AsTime(), + }) + } } - - batchReq.Operation = &workflowservice.StartBatchOperationRequest_UpdateActivityOptionsOperation{ - UpdateActivityOptionsOperation: updateActivitiesOperation, + if len(textTable) > 0 { + _ = cctx.Printer.PrintStructured(textTable, printer.StructuredOptions{ + Fields: []string{"Status", "ActivityId", "Type", "StartTime"}, + Table: &printer.TableOptions{NoHeader: pageIndex > 0}, + }) } - - if err := startBatchJob(cctx, cl, batchReq); err != nil { - return err + nextPageToken = resp.NextPageToken + if len(nextPageToken) == 0 || (c.Limit > 0 && execsProcessed >= c.Limit) { + return nil } } - return nil } -func (c *TemporalActivityPauseCommand) run(cctx *CommandContext, args []string) error { +func (c *TemporalActivityCountCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - request := &workflowservice.PauseActivityRequest{ + resp, err := cl.WorkflowService().CountActivityExecutions(cctx, &workflowservice.CountActivityExecutionsRequest{ Namespace: c.Parent.Namespace, - Execution: &common.WorkflowExecution{ - WorkflowId: c.WorkflowId, - RunId: c.RunId, - }, - Identity: c.Parent.Identity, + Query: c.Query, + }) + if err != nil { + return fmt.Errorf("failed counting activities: %w", err) } - - if c.ActivityId != "" && c.ActivityType != "" { - return fmt.Errorf("either Activity Type or Activity Id, but not both") - } else if c.ActivityType != "" { - request.Activity = &workflowservice.PauseActivityRequest_Type{Type: c.ActivityType} - } else if c.ActivityId != "" { - request.Activity = &workflowservice.PauseActivityRequest_Id{Id: c.ActivityId} + if cctx.JSONOutput { + for _, group := range resp.Groups { + for _, payload := range group.GroupValues { + delete(payload.GetMetadata(), "type") + } + } + return cctx.Printer.PrintStructured(resp, printer.StructuredOptions{}) } - - _, err = cl.WorkflowService().PauseActivity(cctx, request) - if err != nil { - return fmt.Errorf("unable to pause Activity: %w", err) + cctx.Printer.Printlnf("Total: %v", resp.Count) + for _, group := range resp.Groups { + var valueStr string + for _, payload := range group.GroupValues { + var value any + if err := converter.GetDefaultDataConverter().FromPayload(payload, &value); err != nil { + value = fmt.Sprintf("", err) + } + if valueStr != "" { + valueStr += ", " + } + valueStr += fmt.Sprintf("%v", value) + } + cctx.Printer.Printlnf("Group total: %v, values: %v", group.Count, valueStr) } - return nil } -func (c *TemporalActivityUnpauseCommand) run(cctx *CommandContext, args []string) error { +func (c *TemporalActivityCancelCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - opts := SingleWorkflowOrBatchOptions{ - WorkflowId: c.WorkflowId, + _, err = cl.WorkflowService().RequestCancelActivityExecution(cctx, &workflowservice.RequestCancelActivityExecutionRequest{ + Namespace: c.Parent.Namespace, + ActivityId: c.ActivityId, RunId: c.RunId, - Query: c.Query, + Identity: c.Parent.Identity, + RequestId: uuid.New().String(), Reason: c.Reason, - Yes: c.Yes, - Rps: c.Rps, + }) + if err != nil { + return fmt.Errorf("failed to cancel activity: %w", err) } + cctx.Printer.Println("Cancellation requested") + return nil +} - exec, batchReq, err := opts.workflowExecOrBatch(cctx, c.Parent.Namespace, cl, singleOrBatchOverrides{}) +func (c *TemporalActivityTerminateCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } + defer cl.Close() - if exec != nil { // single workflow operation - request := &workflowservice.UnpauseActivityRequest{ - Namespace: c.Parent.Namespace, - Execution: &common.WorkflowExecution{ - WorkflowId: c.WorkflowId, - RunId: c.RunId, - }, - ResetAttempts: c.ResetAttempts, - ResetHeartbeat: c.ResetHeartbeats, - Jitter: durationpb.New(c.Jitter.Duration()), - Identity: c.Parent.Identity, - } - - if c.ActivityId != "" && c.ActivityType != "" { - return fmt.Errorf("either Activity Type or Activity Id, but not both") - } else if c.ActivityType != "" { - request.Activity = &workflowservice.UnpauseActivityRequest_Type{Type: c.ActivityType} - } else if c.ActivityId != "" { - request.Activity = &workflowservice.UnpauseActivityRequest_Id{Id: c.ActivityId} - } - - _, err = cl.WorkflowService().UnpauseActivity(cctx, request) - if err != nil { - return fmt.Errorf("unable to unpause an Activity: %w", err) - } - } else { // batch operation - unpauseActivitiesOperation := &batch.BatchOperationUnpauseActivities{ - Identity: c.Parent.Identity, - ResetAttempts: c.ResetAttempts, - ResetHeartbeat: c.ResetHeartbeats, - Jitter: durationpb.New(c.Jitter.Duration()), - } - if c.ActivityType != "" { - unpauseActivitiesOperation.Activity = &batch.BatchOperationUnpauseActivities_Type{Type: c.ActivityType} - } else if c.MatchAll { - unpauseActivitiesOperation.Activity = &batch.BatchOperationUnpauseActivities_MatchAll{MatchAll: true} - } else { - return fmt.Errorf("either Activity Type must be provided or MatchAll must be set to true") - } - - batchReq.Operation = &workflowservice.StartBatchOperationRequest_UnpauseActivitiesOperation{ - UnpauseActivitiesOperation: unpauseActivitiesOperation, - } - - if err := startBatchJob(cctx, cl, batchReq); err != nil { - return err - } + reason := c.Reason + if reason == "" { + reason = defaultReason() } - + _, err = cl.WorkflowService().TerminateActivityExecution(cctx, &workflowservice.TerminateActivityExecutionRequest{ + Namespace: c.Parent.Namespace, + ActivityId: c.ActivityId, + RunId: c.RunId, + Identity: c.Parent.Identity, + RequestId: uuid.New().String(), + Reason: reason, + }) + if err != nil { + return fmt.Errorf("failed to terminate activity: %w", err) + } + cctx.Printer.Println("Activity terminated") return nil } -func (c *TemporalActivityResetCommand) run(cctx *CommandContext, args []string) error { +func (c *TemporalActivityCompleteCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - opts := SingleWorkflowOrBatchOptions{ + metadata := map[string][][]byte{"encoding": {[]byte("json/plain")}} + resultPayloads, err := CreatePayloads([][]byte{[]byte(c.Result)}, metadata, false) + if err != nil { + return err + } + + _, err = cl.WorkflowService().RespondActivityTaskCompletedById(cctx, &workflowservice.RespondActivityTaskCompletedByIdRequest{ + Namespace: c.Parent.Namespace, WorkflowId: c.WorkflowId, RunId: c.RunId, - Query: c.Query, - Reason: c.Reason, - Yes: c.Yes, - Rps: c.Rps, + ActivityId: c.ActivityId, + Result: resultPayloads, + Identity: c.Parent.Identity, + }) + if err != nil { + return fmt.Errorf("unable to complete Activity: %w", err) } + return nil +} - exec, batchReq, err := opts.workflowExecOrBatch(cctx, c.Parent.Namespace, cl, singleOrBatchOverrides{}) +func (c *TemporalActivityFailCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } + defer cl.Close() - if exec != nil { // single workflow operation - request := &workflowservice.ResetActivityRequest{ - Namespace: c.Parent.Namespace, - Execution: &common.WorkflowExecution{ - WorkflowId: c.WorkflowId, - RunId: c.RunId, - }, - Identity: c.Parent.Identity, - KeepPaused: c.KeepPaused, - ResetHeartbeat: c.ResetHeartbeats, - } - - if c.ActivityId != "" && c.ActivityType != "" { - return fmt.Errorf("either Activity Type or Activity Id, but not both") - } else if c.ActivityType != "" { - request.Activity = &workflowservice.ResetActivityRequest_Type{Type: c.ActivityType} - } else if c.ActivityId != "" { - request.Activity = &workflowservice.ResetActivityRequest_Id{Id: c.ActivityId} - } else { - return fmt.Errorf("either Activity Type or Activity Id must be provided") + var detailPayloads *common.Payloads + if len(c.Detail) > 0 { + metadata := map[string][][]byte{"encoding": {[]byte("json/plain")}} + detailPayloads, err = CreatePayloads([][]byte{[]byte(c.Detail)}, metadata, false) + if err != nil { + return err } + } + _, err = cl.WorkflowService().RespondActivityTaskFailedById(cctx, &workflowservice.RespondActivityTaskFailedByIdRequest{ + Namespace: c.Parent.Namespace, + WorkflowId: c.WorkflowId, + RunId: c.RunId, + ActivityId: c.ActivityId, + Failure: &failure.Failure{ + Message: c.Reason, + Source: "CLI", + FailureInfo: &failure.Failure_ApplicationFailureInfo{ApplicationFailureInfo: &failure.ApplicationFailureInfo{ + NonRetryable: true, + Details: detailPayloads, + }}, + }, + Identity: c.Parent.Identity, + }) + if err != nil { + return fmt.Errorf("unable to fail Activity: %w", err) + } + return nil +} - resp, err := cl.WorkflowService().ResetActivity(cctx, request) +func (c *TemporalActivityUpdateOptionsCommand) run(cctx *CommandContext, args []string) error { + cl, err := dialClient(cctx, &c.Parent.ClientOptions) + if err != nil { + return err + } + defer cl.Close() + + updatePath := []string{} + activityOptions := &activitypb.ActivityOptions{} + + if c.Command.Flags().Changed("task-queue") { + activityOptions.TaskQueue = &taskqueuepb.TaskQueue{Name: c.TaskQueue} + updatePath = append(updatePath, "task_queue_name") + } + + if c.Command.Flags().Changed("schedule-to-close-timeout") { + activityOptions.ScheduleToCloseTimeout = durationpb.New(c.ScheduleToCloseTimeout.Duration()) + updatePath = append(updatePath, "schedule_to_close_timeout") + } + + if c.Command.Flags().Changed("schedule-to-start-timeout") { + activityOptions.ScheduleToStartTimeout = durationpb.New(c.ScheduleToStartTimeout.Duration()) + updatePath = append(updatePath, "schedule_to_start_timeout") + } + + if c.Command.Flags().Changed("start-to-close-timeout") { + activityOptions.StartToCloseTimeout = durationpb.New(c.StartToCloseTimeout.Duration()) + updatePath = append(updatePath, "start_to_close_timeout") + } + + if c.Command.Flags().Changed("heartbeat-timeout") { + activityOptions.HeartbeatTimeout = durationpb.New(c.HeartbeatTimeout.Duration()) + updatePath = append(updatePath, "heartbeat_timeout") + } + + if c.Command.Flags().Changed("retry-initial-interval") || + c.Command.Flags().Changed("retry-maximum-interval") || + c.Command.Flags().Changed("retry-backoff-coefficient") || + c.Command.Flags().Changed("retry-maximum-attempts") { + activityOptions.RetryPolicy = &common.RetryPolicy{} + } + + if c.Command.Flags().Changed("retry-initial-interval") { + activityOptions.RetryPolicy.InitialInterval = durationpb.New(c.RetryInitialInterval.Duration()) + updatePath = append(updatePath, "retry_policy.initial_interval") + } + + if c.Command.Flags().Changed("retry-maximum-interval") { + activityOptions.RetryPolicy.MaximumInterval = durationpb.New(c.RetryMaximumInterval.Duration()) + updatePath = append(updatePath, "retry_policy.maximum_interval") + } + + if c.Command.Flags().Changed("retry-backoff-coefficient") { + activityOptions.RetryPolicy.BackoffCoefficient = float64(c.RetryBackoffCoefficient) + updatePath = append(updatePath, "retry_policy.backoff_coefficient") + } + + if c.Command.Flags().Changed("retry-maximum-attempts") { + activityOptions.RetryPolicy.MaximumAttempts = int32(c.RetryMaximumAttempts) + updatePath = append(updatePath, "retry_policy.maximum_attempts") + } + + opts := SingleWorkflowOrBatchOptions{ + WorkflowId: c.WorkflowId, + RunId: c.RunId, + Query: c.Query, + Reason: c.Reason, + Yes: c.Yes, + Rps: c.Rps, + } + + exec, batchReq, err := opts.workflowExecOrBatch(cctx, c.Parent.Namespace, cl, singleOrBatchOverrides{}) + if err != nil { + return err + } + + if exec != nil { + result, err := cl.WorkflowService().UpdateActivityOptions(cctx, &workflowservice.UpdateActivityOptionsRequest{ + Namespace: c.Parent.Namespace, + Execution: &common.WorkflowExecution{ + WorkflowId: c.WorkflowId, + RunId: c.RunId, + }, + Activity: &workflowservice.UpdateActivityOptionsRequest_Id{Id: c.ActivityId}, + ActivityOptions: activityOptions, + UpdateMask: &fieldmaskpb.FieldMask{ + Paths: updatePath, + }, + Identity: c.Parent.Identity, + }) if err != nil { - return fmt.Errorf("unable to reset an Activity: %w", err) + return fmt.Errorf("unable to update Activity options: %w", err) } - resetResponse := struct { - KeepPaused bool `json:"keepPaused"` - ResetHeartbeats bool `json:"resetHeartbeats"` - ServerResponse bool `json:"-"` - }{ - ServerResponse: resp != nil, - KeepPaused: c.KeepPaused, - ResetHeartbeats: c.ResetHeartbeats, + updatedOptions := updateOptionsDescribe{ + TaskQueue: result.GetActivityOptions().TaskQueue.GetName(), + + ScheduleToCloseTimeout: result.GetActivityOptions().ScheduleToCloseTimeout.AsDuration(), + ScheduleToStartTimeout: result.GetActivityOptions().ScheduleToStartTimeout.AsDuration(), + StartToCloseTimeout: result.GetActivityOptions().StartToCloseTimeout.AsDuration(), + HeartbeatTimeout: result.GetActivityOptions().HeartbeatTimeout.AsDuration(), + + InitialInterval: result.GetActivityOptions().RetryPolicy.InitialInterval.AsDuration(), + BackoffCoefficient: result.GetActivityOptions().RetryPolicy.BackoffCoefficient, + MaximumInterval: result.GetActivityOptions().RetryPolicy.MaximumInterval.AsDuration(), + MaximumAttempts: result.GetActivityOptions().RetryPolicy.MaximumAttempts, } - _ = cctx.Printer.PrintStructured(resetResponse, printer.StructuredOptions{}) - } else { // batch operation - resetActivitiesOperation := &batch.BatchOperationResetActivities{ - Identity: c.Parent.Identity, - ResetAttempts: c.ResetAttempts, - ResetHeartbeat: c.ResetHeartbeats, - KeepPaused: c.KeepPaused, - Jitter: durationpb.New(c.Jitter.Duration()), - RestoreOriginalOptions: c.RestoreOriginalOptions, + _ = cctx.Printer.PrintStructured(updatedOptions, printer.StructuredOptions{}) + } else { + updateActivitiesOperation := &batch.BatchOperationUpdateActivityOptions{ + Identity: c.Parent.Identity, + Activity: &batch.BatchOperationUpdateActivityOptions_Type{Type: c.ActivityType}, + UpdateMask: &fieldmaskpb.FieldMask{ + Paths: updatePath, + }, + RestoreOriginal: c.RestoreOriginalOptions, } + if c.ActivityType != "" { - resetActivitiesOperation.Activity = &batch.BatchOperationResetActivities_Type{Type: c.ActivityType} + updateActivitiesOperation.Activity = &batch.BatchOperationUpdateActivityOptions_Type{Type: c.ActivityType} } else if c.MatchAll { - resetActivitiesOperation.Activity = &batch.BatchOperationResetActivities_MatchAll{MatchAll: true} + updateActivitiesOperation.Activity = &batch.BatchOperationUpdateActivityOptions_MatchAll{MatchAll: true} } else { return fmt.Errorf("either Activity Type must be provided or MatchAll must be set to true") } - batchReq.Operation = &workflowservice.StartBatchOperationRequest_ResetActivitiesOperation{ - ResetActivitiesOperation: resetActivitiesOperation, + batchReq.Operation = &workflowservice.StartBatchOperationRequest_UpdateActivityOptionsOperation{ + UpdateActivityOptionsOperation: updateActivitiesOperation, } if err := startBatchJob(cctx, cl, batchReq); err != nil { return err } } - return nil } -func (c *TemporalActivityStartCommand) run(cctx *CommandContext, args []string) error { +func (c *TemporalActivityPauseCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - req, err := buildStartActivityRequest(cctx, c.Parent, &c.ActivityStartOptions, &c.PayloadInputOptions) - if err != nil { - return err - } - resp, err := cl.WorkflowService().StartActivityExecution(cctx, req) - if err != nil { - return fmt.Errorf("failed starting activity: %w", err) - } - return cctx.Printer.PrintStructured(struct { - ActivityId string `json:"activityId"` - RunId string `json:"runId"` - Started bool `json:"started"` - }{ - ActivityId: c.ActivityId, - RunId: resp.RunId, - Started: resp.Started, - }, printer.StructuredOptions{}) -} - -func (c *TemporalActivityExecuteCommand) run(cctx *CommandContext, args []string) error { - cl, err := dialClient(cctx, &c.Parent.ClientOptions) - if err != nil { - return err + request := &workflowservice.PauseActivityRequest{ + Namespace: c.Parent.Namespace, + Execution: &common.WorkflowExecution{ + WorkflowId: c.WorkflowId, + RunId: c.RunId, + }, + Identity: c.Parent.Identity, } - defer cl.Close() - req, err := buildStartActivityRequest(cctx, c.Parent, &c.ActivityStartOptions, &c.PayloadInputOptions) - if err != nil { - return err - } - startResp, err := cl.WorkflowService().StartActivityExecution(cctx, req) - if err != nil { - return fmt.Errorf("failed starting activity: %w", err) + if c.ActivityId != "" && c.ActivityType != "" { + return fmt.Errorf("either Activity Type or Activity Id, but not both") + } else if c.ActivityType != "" { + request.Activity = &workflowservice.PauseActivityRequest_Type{Type: c.ActivityType} + } else if c.ActivityId != "" { + request.Activity = &workflowservice.PauseActivityRequest_Id{Id: c.ActivityId} } - return getActivityResult(cctx, cl, c.ActivityId, startResp.RunId) -} -func (c *TemporalActivityResultCommand) run(cctx *CommandContext, args []string) error { - cl, err := dialClient(cctx, &c.Parent.ClientOptions) + _, err = cl.WorkflowService().PauseActivity(cctx, request) if err != nil { - return err + return fmt.Errorf("unable to pause Activity: %w", err) } - defer cl.Close() - return getActivityResult(cctx, cl, c.ActivityId, c.RunId) + return nil } -func (c *TemporalActivityDescribeCommand) run(cctx *CommandContext, args []string) error { +func (c *TemporalActivityUnpauseCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - resp, err := cl.WorkflowService().DescribeActivityExecution(cctx, &workflowservice.DescribeActivityExecutionRequest{ - Namespace: c.Parent.Namespace, - ActivityId: c.ActivityId, - RunId: c.RunId, - IncludeInput: true, - IncludeOutcome: true, - }) - if err != nil { - return fmt.Errorf("failed describing activity: %w", err) - } - if c.Raw || cctx.JSONOutput { - return cctx.Printer.PrintStructured(resp, printer.StructuredOptions{}) + opts := SingleWorkflowOrBatchOptions{ + WorkflowId: c.WorkflowId, + RunId: c.RunId, + Query: c.Query, + Reason: c.Reason, + Yes: c.Yes, + Rps: c.Rps, } - return cctx.Printer.PrintStructured(resp.Info, printer.StructuredOptions{}) -} -func (c *TemporalActivityListCommand) run(cctx *CommandContext, args []string) error { - cl, err := dialClient(cctx, &c.Parent.ClientOptions) + exec, batchReq, err := opts.workflowExecOrBatch(cctx, c.Parent.Namespace, cl, singleOrBatchOverrides{}) if err != nil { return err } - defer cl.Close() - - cctx.Printer.StartList() - defer cctx.Printer.EndList() - var nextPageToken []byte - var execsProcessed int - for pageIndex := 0; ; pageIndex++ { - resp, err := cl.WorkflowService().ListActivityExecutions(cctx, &workflowservice.ListActivityExecutionsRequest{ - Namespace: c.Parent.Namespace, - PageSize: int32(c.PageSize), - NextPageToken: nextPageToken, - Query: c.Query, - }) - if err != nil { - return fmt.Errorf("failed listing activities: %w", err) + if exec != nil { // single workflow operation + request := &workflowservice.UnpauseActivityRequest{ + Namespace: c.Parent.Namespace, + Execution: &common.WorkflowExecution{ + WorkflowId: c.WorkflowId, + RunId: c.RunId, + }, + ResetAttempts: c.ResetAttempts, + ResetHeartbeat: c.ResetHeartbeats, + Jitter: durationpb.New(c.Jitter.Duration()), + Identity: c.Parent.Identity, } - var textTable []map[string]any - for _, exec := range resp.Executions { - if c.Limit > 0 && execsProcessed >= c.Limit { - break - } - execsProcessed++ - if cctx.JSONOutput { - _ = cctx.Printer.PrintStructured(exec, printer.StructuredOptions{}) - } else { - textTable = append(textTable, map[string]any{ - "Status": exec.Status, - "ActivityId": exec.ActivityId, - "Type": exec.ActivityType.GetName(), - "StartTime": exec.ScheduleTime.AsTime(), - }) - } + + if c.ActivityId != "" && c.ActivityType != "" { + return fmt.Errorf("either Activity Type or Activity Id, but not both") + } else if c.ActivityType != "" { + request.Activity = &workflowservice.UnpauseActivityRequest_Type{Type: c.ActivityType} + } else if c.ActivityId != "" { + request.Activity = &workflowservice.UnpauseActivityRequest_Id{Id: c.ActivityId} } - if len(textTable) > 0 { - _ = cctx.Printer.PrintStructured(textTable, printer.StructuredOptions{ - Fields: []string{"Status", "ActivityId", "Type", "StartTime"}, - Table: &printer.TableOptions{NoHeader: pageIndex > 0}, - }) + + _, err = cl.WorkflowService().UnpauseActivity(cctx, request) + if err != nil { + return fmt.Errorf("unable to unpause an Activity: %w", err) } - nextPageToken = resp.NextPageToken - if len(nextPageToken) == 0 || (c.Limit > 0 && execsProcessed >= c.Limit) { - return nil + } else { // batch operation + unpauseActivitiesOperation := &batch.BatchOperationUnpauseActivities{ + Identity: c.Parent.Identity, + ResetAttempts: c.ResetAttempts, + ResetHeartbeat: c.ResetHeartbeats, + Jitter: durationpb.New(c.Jitter.Duration()), + } + if c.ActivityType != "" { + unpauseActivitiesOperation.Activity = &batch.BatchOperationUnpauseActivities_Type{Type: c.ActivityType} + } else if c.MatchAll { + unpauseActivitiesOperation.Activity = &batch.BatchOperationUnpauseActivities_MatchAll{MatchAll: true} + } else { + return fmt.Errorf("either Activity Type must be provided or MatchAll must be set to true") } - } -} - -func (c *TemporalActivityCountCommand) run(cctx *CommandContext, args []string) error { - cl, err := dialClient(cctx, &c.Parent.ClientOptions) - if err != nil { - return err - } - defer cl.Close() - resp, err := cl.WorkflowService().CountActivityExecutions(cctx, &workflowservice.CountActivityExecutionsRequest{ - Namespace: c.Parent.Namespace, - Query: c.Query, - }) - if err != nil { - return fmt.Errorf("failed counting activities: %w", err) - } - if cctx.JSONOutput { - for _, group := range resp.Groups { - for _, payload := range group.GroupValues { - delete(payload.GetMetadata(), "type") - } + batchReq.Operation = &workflowservice.StartBatchOperationRequest_UnpauseActivitiesOperation{ + UnpauseActivitiesOperation: unpauseActivitiesOperation, } - return cctx.Printer.PrintStructured(resp, printer.StructuredOptions{}) - } - cctx.Printer.Printlnf("Total: %v", resp.Count) - for _, group := range resp.Groups { - var valueStr string - for _, payload := range group.GroupValues { - var value any - if err := converter.GetDefaultDataConverter().FromPayload(payload, &value); err != nil { - value = fmt.Sprintf("", err) - } - if valueStr != "" { - valueStr += ", " - } - valueStr += fmt.Sprintf("%v", value) + + if err := startBatchJob(cctx, cl, batchReq); err != nil { + return err } - cctx.Printer.Printlnf("Group total: %v, values: %v", group.Count, valueStr) } + return nil } -func (c *TemporalActivityCancelCommand) run(cctx *CommandContext, args []string) error { +func (c *TemporalActivityResetCommand) run(cctx *CommandContext, args []string) error { cl, err := dialClient(cctx, &c.Parent.ClientOptions) if err != nil { return err } defer cl.Close() - _, err = cl.WorkflowService().RequestCancelActivityExecution(cctx, &workflowservice.RequestCancelActivityExecutionRequest{ - Namespace: c.Parent.Namespace, - ActivityId: c.ActivityId, + opts := SingleWorkflowOrBatchOptions{ + WorkflowId: c.WorkflowId, RunId: c.RunId, - Identity: c.Parent.Identity, - RequestId: uuid.New().String(), + Query: c.Query, Reason: c.Reason, - }) - if err != nil { - return fmt.Errorf("failed to cancel activity: %w", err) + Yes: c.Yes, + Rps: c.Rps, } - cctx.Printer.Println("Cancellation requested") - return nil -} -func (c *TemporalActivityTerminateCommand) run(cctx *CommandContext, args []string) error { - cl, err := dialClient(cctx, &c.Parent.ClientOptions) + exec, batchReq, err := opts.workflowExecOrBatch(cctx, c.Parent.Namespace, cl, singleOrBatchOverrides{}) if err != nil { return err } - defer cl.Close() - - reason := c.Reason - if reason == "" { - reason = defaultReason() - } - _, err = cl.WorkflowService().TerminateActivityExecution(cctx, &workflowservice.TerminateActivityExecutionRequest{ - Namespace: c.Parent.Namespace, - ActivityId: c.ActivityId, - RunId: c.RunId, - Identity: c.Parent.Identity, - RequestId: uuid.New().String(), - Reason: reason, - }) - if err != nil { - return fmt.Errorf("failed to terminate activity: %w", err) - } - cctx.Printer.Println("Activity terminated") - return nil -} - -func getActivityResult(cctx *CommandContext, cl client.Client, activityID, runID string) error { - handle := cl.GetActivityHandle(client.GetActivityHandleOptions{ - ActivityID: activityID, - RunID: runID, - }) - var valuePtr interface{} - if err := handle.Get(cctx, &valuePtr); err != nil { - return fmt.Errorf("activity failed: %w", err) - } - if cctx.JSONOutput { - return cctx.Printer.PrintStructured( - struct { - Result interface{} `json:"result"` - }{Result: valuePtr}, - printer.StructuredOptions{}) - } - jsonBytes, err := json.Marshal(valuePtr) - if err != nil { - return fmt.Errorf("failed marshaling result: %w", err) - } - cctx.Printer.Printlnf("Result: %s", jsonBytes) - return nil -} -func buildStartActivityRequest( - cctx *CommandContext, - parent *TemporalActivityCommand, - opts *ActivityStartOptions, - inputOpts *PayloadInputOptions, -) (*workflowservice.StartActivityExecutionRequest, error) { - input, err := inputOpts.buildRawInputPayloads() - if err != nil { - return nil, err - } - - req := &workflowservice.StartActivityExecutionRequest{ - Namespace: parent.Namespace, - Identity: parent.Identity, - RequestId: uuid.New().String(), - ActivityId: opts.ActivityId, - ActivityType: &common.ActivityType{ - Name: opts.Type, - }, - TaskQueue: &taskqueuepb.TaskQueue{ - Name: opts.TaskQueue, - }, - ScheduleToCloseTimeout: durationpb.New(opts.ScheduleToCloseTimeout.Duration()), - ScheduleToStartTimeout: durationpb.New(opts.ScheduleToStartTimeout.Duration()), - StartToCloseTimeout: durationpb.New(opts.StartToCloseTimeout.Duration()), - HeartbeatTimeout: durationpb.New(opts.HeartbeatTimeout.Duration()), - Input: input, - } - - if opts.RetryInitialInterval.Duration() > 0 || opts.RetryMaximumInterval.Duration() > 0 || - opts.RetryBackoffCoefficient > 0 || opts.RetryMaximumAttempts > 0 { - req.RetryPolicy = &common.RetryPolicy{} - if opts.RetryInitialInterval.Duration() > 0 { - req.RetryPolicy.InitialInterval = durationpb.New(opts.RetryInitialInterval.Duration()) - } - if opts.RetryMaximumInterval.Duration() > 0 { - req.RetryPolicy.MaximumInterval = durationpb.New(opts.RetryMaximumInterval.Duration()) - } - if opts.RetryBackoffCoefficient > 0 { - req.RetryPolicy.BackoffCoefficient = float64(opts.RetryBackoffCoefficient) - } - if opts.RetryMaximumAttempts > 0 { - req.RetryPolicy.MaximumAttempts = int32(opts.RetryMaximumAttempts) + if exec != nil { // single workflow operation + request := &workflowservice.ResetActivityRequest{ + Namespace: c.Parent.Namespace, + Execution: &common.WorkflowExecution{ + WorkflowId: c.WorkflowId, + RunId: c.RunId, + }, + Identity: c.Parent.Identity, + KeepPaused: c.KeepPaused, + ResetHeartbeat: c.ResetHeartbeats, } - } - if opts.IdReusePolicy.Value != "" { - v, err := stringToProtoEnum[enumspb.ActivityIdReusePolicy]( - opts.IdReusePolicy.Value, enumspb.ActivityIdReusePolicy_shorthandValue, enumspb.ActivityIdReusePolicy_value) - if err != nil { - return nil, fmt.Errorf("invalid activity ID reuse policy: %w", err) - } - req.IdReusePolicy = v - } - if opts.IdConflictPolicy.Value != "" { - v, err := stringToProtoEnum[enumspb.ActivityIdConflictPolicy]( - opts.IdConflictPolicy.Value, enumspb.ActivityIdConflictPolicy_shorthandValue, enumspb.ActivityIdConflictPolicy_value) - if err != nil { - return nil, fmt.Errorf("invalid activity ID conflict policy: %w", err) + if c.ActivityId != "" && c.ActivityType != "" { + return fmt.Errorf("either Activity Type or Activity Id, but not both") + } else if c.ActivityType != "" { + request.Activity = &workflowservice.ResetActivityRequest_Type{Type: c.ActivityType} + } else if c.ActivityId != "" { + request.Activity = &workflowservice.ResetActivityRequest_Id{Id: c.ActivityId} + } else { + return fmt.Errorf("either Activity Type or Activity Id must be provided") } - req.IdConflictPolicy = v - } - if len(opts.SearchAttribute) > 0 { - saMap, err := stringKeysJSONValues(opts.SearchAttribute, false) + resp, err := cl.WorkflowService().ResetActivity(cctx, request) if err != nil { - return nil, fmt.Errorf("invalid search attribute values: %w", err) + return fmt.Errorf("unable to reset an Activity: %w", err) } - saPayloads, err := encodeMapToPayloads(saMap) - if err != nil { - return nil, fmt.Errorf("failed encoding search attributes: %w", err) + + resetResponse := struct { + KeepPaused bool `json:"keepPaused"` + ResetHeartbeats bool `json:"resetHeartbeats"` + ServerResponse bool `json:"-"` + }{ + ServerResponse: resp != nil, + KeepPaused: c.KeepPaused, + ResetHeartbeats: c.ResetHeartbeats, } - req.SearchAttributes = &common.SearchAttributes{IndexedFields: saPayloads} - } - if len(opts.Headers) > 0 { - headerMap, err := stringKeysJSONValues(opts.Headers, false) - if err != nil { - return nil, fmt.Errorf("invalid header values: %w", err) + _ = cctx.Printer.PrintStructured(resetResponse, printer.StructuredOptions{}) + } else { // batch operation + resetActivitiesOperation := &batch.BatchOperationResetActivities{ + Identity: c.Parent.Identity, + ResetAttempts: c.ResetAttempts, + ResetHeartbeat: c.ResetHeartbeats, + KeepPaused: c.KeepPaused, + Jitter: durationpb.New(c.Jitter.Duration()), + RestoreOriginalOptions: c.RestoreOriginalOptions, } - headerPayloads, err := encodeMapToPayloads(headerMap) - if err != nil { - return nil, fmt.Errorf("failed encoding headers: %w", err) + if c.ActivityType != "" { + resetActivitiesOperation.Activity = &batch.BatchOperationResetActivities_Type{Type: c.ActivityType} + } else if c.MatchAll { + resetActivitiesOperation.Activity = &batch.BatchOperationResetActivities_MatchAll{MatchAll: true} + } else { + return fmt.Errorf("either Activity Type must be provided or MatchAll must be set to true") } - req.Header = &common.Header{Fields: headerPayloads} - } - if opts.StaticSummary != "" || opts.StaticDetails != "" { - req.UserMetadata = &sdkpb.UserMetadata{} - if opts.StaticSummary != "" { - req.UserMetadata.Summary = &common.Payload{ - Metadata: map[string][]byte{"encoding": []byte("json/plain")}, - Data: []byte(fmt.Sprintf("%q", opts.StaticSummary)), - } - } - if opts.StaticDetails != "" { - req.UserMetadata.Details = &common.Payload{ - Metadata: map[string][]byte{"encoding": []byte("json/plain")}, - Data: []byte(fmt.Sprintf("%q", opts.StaticDetails)), - } + batchReq.Operation = &workflowservice.StartBatchOperationRequest_ResetActivitiesOperation{ + ResetActivitiesOperation: resetActivitiesOperation, } - } - if opts.PriorityKey > 0 || opts.FairnessKey != "" || opts.FairnessWeight > 0 { - req.Priority = &common.Priority{ - PriorityKey: int32(opts.PriorityKey), - FairnessKey: opts.FairnessKey, - FairnessWeight: float32(opts.FairnessWeight), + if err := startBatchJob(cctx, cl, batchReq); err != nil { + return err } } - return req, nil + return nil }