Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the Cloud Run compute configuration changes.
No open issues 🎉
What changed in this PR
Extends the experimental worker deployment version command tree introduced in #1235 with GCP Cloud Run compute configuration commands, while leaving existing commands unchanged.
Changes:
- Adds Cloud Run
createandupdatecommands with named scaling groups, provider validation, and all-or-none scaler flags, including cooldowns. - Displays rate-based scaler settings in text and JSON descriptions.
- Adds tests for request payloads, partial updates, validation errors, and description output.
| File | Description |
|---|---|
internal/temporalcli/commands.yaml |
Defines Cloud Run commands, scaler flags, and help text. |
internal/temporalcli/commands.worker.deployment.version.go |
Decodes and formats rate-based scaler settings. |
internal/temporalcli/commands.worker.deployment.version.gcp_cloud_run.go |
Implements Cloud Run create/update requests and validation. |
internal/temporalcli/commands.worker.deployment.version.gcp_cloud_run_test.go |
Tests Cloud Run commands, partial updates, and error handling. |
internal/temporalcli/commands.worker.deployment.version_test.go |
Tests rate-based scaler descriptions in text and JSON. |
internal/temporalcli/commands.gen.go |
Registers generated commands and flag bindings. |
Review effort: Balanced
ks-temporal
left a comment
There was a problem hiding this comment.
Hi, I am adding some comments, mostly to understand/explain the difference from other provider flags/commands. Please use a new incremental commit if any changes are applied/done, so that the differential changes can be reviewed incrementally, instead of doing a force-push or rebase with the changes, which loses the old vs. new changes difference.
| --project YourGCPProject \ | ||
| --worker-pool-region us-central1 \ | ||
| --worker-pool YourWorkerPool \ | ||
| --service-account customer-sa@proj.iam.gserviceaccount.com |
There was a problem hiding this comment.
Should this be YourServiceAccountEmail instead of email format? Or if the account is always in this format after @ then keeping it like YourAccount@proj.iam... might be better?
There was a problem hiding this comment.
makes sense i'll switch to YourServiceAccount@project-x.iam.gserviceaccount.com.
| (--min-instances, --max-instances, --initial-instances, | ||
| --utilization-target, --scale-down-stabilization-ms, | ||
| --scale-up-cooldown-ms, and --scale-down-cooldown-ms) together. When | ||
| none are passed, the server defaults apply: |
There was a problem hiding this comment.
This appears different than aws-agentcore. "When none are passed..." => what if some are passed, will default for remaining apply? If yes, then reword to "Each one that is not set keeps the server default:" similar to agentcore help text. Or if it is an error to pass only some flags, but not all, then indicate so.
There was a problem hiding this comment.
The flags are different across agentcore and cloudrun but the behavior is the same, here is where we call out similar behavior in the agentcore PR https://github.com/temporalio/cli/pull/1261/changes#diff-e1e06b576c4db2c77ee10bb962c28c8c3850f2d5f79ea2e3a9bfa114fa32786dR4391
There was a problem hiding this comment.
I initially left this the same as main but I'm changing it to keep it consistent with agentcore and lambda as below
- anytime provider is modified and scaler details are not passed, they will be reset to defaults. it is no longer the all or none behavior.
- scaler flags can be passed individually, and any flag not set keeps the server default.
| required: true | ||
| description: | | ||
| Customer GCP service account the Temporal server impersonates to | ||
| manage the Cloud Run worker pool. |
There was a problem hiding this comment.
Is this always an email format? If yes, then indicate so.
| ``` | ||
|
|
||
| To update only the scaler of an existing scaling group, supply the | ||
| scaler flags without the provider flags: |
There was a problem hiding this comment.
Is scaler replaced as a whole similar to agentcore? If yes, indicate so - either pass all the scaler flags, or what happens for missing flags.
There was a problem hiding this comment.
Yes, scaler will be replaced with defaults if provider is modified without any scaler flags
There was a problem hiding this comment.
I initially left this the same as main but I'm changing it to keep it consistent with agentcore and lambda as below
anytime provider is modified and scaler details are not passed, they will be reset to defaults. it is no longer the all or none behavior.
scaler flags can be passed individually, and any flag not set keeps the server default.
| changing the compute provider, and they must all be passed together. | ||
| The scaler flags must also all be passed together. Changing the | ||
| provider keeps the scaler settings, unless the scaler flags are | ||
| passed with it to replace them. |
There was a problem hiding this comment.
This also appears to be different from other providers like agentcore. What happens if scaling group provider is changed from a previous one to this gcp one, and scaler flags are not passed. If you don't reset the scaler when changing the provider here, but do so in others, I think it could lead to some inconsistencies.
There was a problem hiding this comment.
Right, I forgot to mention this in the PR. I tried to keep it the same as current main behavior to keep the changes minimal to just the command restructuring. But, now that I think about it kind of makes sense to keep it consistent, I will check with the team and see if there is any specific reasoning for cloudrun alone.
| type: int | ||
| description: | | ||
| Minimum time between two scale-ups of the Cloud Run worker pool, in | ||
| milliseconds. Must not exceed the scaler's metrics poll interval of |
There was a problem hiding this comment.
is the metrics poll interval server side config? Is that update-able, or is the value 1m hardcoded? If update-able, then this may need re-wording to indicate so, e.g., "... poll interval, which defaults to ..."
There was a problem hiding this comment.
this should be configurable if we are opening up the scaling param t be configurable, let me check and fix that and the wording here.
| description: | | ||
| Minimum number of Cloud Run worker pool instances the scaler will | ||
| maintain. Must be passed with the other scaler flags. Defaults to 0 | ||
| when unset. |
There was a problem hiding this comment.
I think this and other flags' text is not clear - "Must be passed... " vs. "... when unset" - which indicates that this is required vs. optional. May be because the default is applied by the server (?) May need rewording to indicate when should this be passed, and when and how the default is applied. e.g., "Must be passed if any other scalar flag is passed". and "If no scaler flags are passed, then defaults to ..." or "... then the server defaults it to ..." Or some other semantics/constraints.
There was a problem hiding this comment.
this was actually replicating the existing main behavior where cloud-run enforces all or none kind of a behavior for scaler flags. I modified this to be consistent with the other two compute providers(lambda and agentcore) where we allow partial flags to be passed and use defaults for those that are not passed, and reset scaler flags that are not specified to defaults when provider is modified.
| - name: min-instances | ||
| type: int | ||
| description: | | ||
| Minimum number of Cloud Run worker pool instances the scaler will |
There was a problem hiding this comment.
Is the option set of rate-based-scaler only intended for GCP Cloud Run? Will it be better to just use "worker pool instances" without "Cloud Run" to make it generic? If yes, then in other flags of this option set as well...
There was a problem hiding this comment.
yes, this is for rate based scaler only. If we name it worker-poll specific(which is cloud run terminology), we won't be able to reuse it for other rate based compute like ECS.
There was a problem hiding this comment.
Ah I misunderstood your comment, if you are referring to the description not stating cloud run - that is a good callout. let me reword it, so we can easily add future rate based compute.
…ntcore and lambda
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
thank you @ks-temporal, addressed your comments in the latest commit. I'm holding off on rebasing onto latest main which will mess up the commit hashes(including the incremental commit). I will rebase and squash before merging. |
Related issues
Follows #1235.
What changed?
Adds
gcp-cloud-runto the experimentaltemporal worker deployment version compute-configtree from #1235, for GCP Cloud Run worker pools. The existing commands are unchanged.Existing commands and their new equivalents
create-version --gcp-cloud-run-*version compute-config gcp-cloud-run create--scaling-groupand the two cooldown flags. If the Version exists, the error points toupdate.update-version-compute-config --gcp-cloud-run-*version compute-config gcp-cloud-run update--scaling-groupand the two cooldown flags. If the Version is missing, the error points tocreate.describe-versionversion compute-config describeThe Cloud Run commands work like the
aws-lambdaones:--project,--worker-pool-region,--worker-pool,--service-account. The region flag is--worker-pool-region, so it can't be confused with--region-id.--min-instances,--max-instances,--initial-instances,--utilization-target, and--scale-down-stabilization-ms, which takes milliseconds like the no-sync-msflags instead of a duration.--scale-up-cooldown-msand--scale-down-cooldown-ms, the rate-based scaler's minimum time between two scale-ups or scale-downs.--scaling-group(defaultdefault) names the scaling group to create or update.Also:
compute-config describeshows the rate-based settings in theScalerline, e.g.rate-based (min_instances 1, max_instances 3, initial_instances 1, utilization_target 0.75, scale_down_stabilization_ms 300000, scale_up_cooldown_ms 2000, scale_down_cooldown_ms 60000), and in JSON (minInstances, …,scaleDownCooldownMs). This addresses the deferred Copilot comment on Adds compute-config commands underworker deployment version, with provider sub-commands #1235.--gcp-cloud-run-*on the existing commands, with main's checks (min ≥ 0, max ≥ 1, min ≤ initial ≤ max, 0 < utilization ≤ 1, stabilization ≥ 0) plus non-negative cooldowns. Their errors name the new flags.Checklist
Design
temporal <noun> <verb>structure (e.g.temporal workflow start)--search-attribute, bad:--index-field)(Experimental)incommands.yamlHelp text (see style guide at the top of
commands.yaml)--namespace, not-n), one flag per lineYourXxxform (YourWorkflowId,YourNamespace)Behavior
Tests
SharedServerSuite)Manual tests
I ran 10 scenarios against a Temporal Cloud test cell with a real GCP Cloud Run worker pool, running the existing and new commands side by side. The new commands behaved as expected: for the same inputs they succeeded or failed like the existing ones, and
version describeprinted the same output asdescribe-versionin text and JSON, including the rate-based scaler summary.Setup: a Worker Deployment
YourDeploymentName, a Cloud Run worker pool, and a service account that the Temporal server can impersonate.Happy path
Scaler flags on their own replace the scaler settings and keep the provider.
--scale-down-stabilization-ms 300000is stored like--gcp-cloud-run-scale-down-stabilization-duration 5m:Provider flags on their own keep the scaler settings, as with
update-version-compute-config:Error cases
The existing commands rejected the same inputs. Only the wording differs where the CLI validates the flags, e.g.
missing required GCP Cloud Run provider detail: projectfor--project is required when changing the provider.Removing the scaling group:
Risks
--scale-down-stabilization-mstakes milliseconds, where--gcp-cloud-run-scale-down-stabilization-durationtook a duration (5m).