From 87301b494b3ed7861aa475012c04a5a2fec6d96e Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 8 Feb 2026 04:57:03 -0500 Subject: [PATCH 01/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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/15] 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