-
Notifications
You must be signed in to change notification settings - Fork 78
Update task queue config cli #840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
stephanos
merged 33 commits into
temporalio:next-server
from
sivagirish81:updateTaskQueueConfigCLI
Oct 2, 2025
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
cd0a8aa
UpdateTaskQueueConfig Cli support init
sivagirish81 a433729
Made namespace mandatory
sivagirish81 6ad0b6f
Added checks for required fields
sivagirish81 fb8080f
added support for report config in describeTaskQueue
sivagirish81 e7aee13
Display config updates in atabular manner
sivagirish81 f7ab06b
Handled unsetting of fields and updated tests
sivagirish81 3100d1a
Changed the long description for the command
sivagirish81 7fffa48
Updated tests and commands.yml
sivagirish81 bf068d1
Added Noop command + fixed tests
sivagirish81 d5fd1dc
Changed display of task queue configuration in describe command
sivagirish81 1c9e6e6
Fixed display to handle long strings in describe command
sivagirish81 d938a57
Added namespace to update-config command help
sivagirish81 a937427
Consistently passing the --identity parameter to server requests
sivagirish81 28ad827
Code refactor + removed default sentinel of -99999
sivagirish81 3317cb1
Added task queue config get/set commands
sivagirish81 000e994
Fixed tests
sivagirish81 3cf9e09
Added required tags for taskqueue name and type
sivagirish81 7acd905
Changed time to time.RFC3339
sivagirish81 8d0450b
Changed requests/second to rps
sivagirish81 f41f50a
rename flags to include rps
stephanos b4b2569
adjust flags to avoid -1
stephanos 7a6cec7
remove dependency replace
stephanos 3b42a83
Update temporalcli/commandsgen/commands.yml
stephanos 2e793cc
re-generate
stephanos e41ee13
add `display-type` docs
stephanos 74622a3
helper to override display type
stephanos 43ff7f6
re-generate
stephanos d29e0e7
go mod tidy
stephanos e2df309
re-generate
stephanos 9c708ab
re-generate
stephanos 3e2c681
remove
stephanos 075e87d
ge-generate
stephanos 7214a44
unexport helper
stephanos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| package temporalcli | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "time" | ||
|
|
||
| "github.com/fatih/color" | ||
| "github.com/temporalio/cli/temporalcli/internal/printer" | ||
| "go.temporal.io/api/enums/v1" | ||
| "go.temporal.io/api/taskqueue/v1" | ||
| ) | ||
|
|
||
| // Create a structured table for config display. | ||
| type configRow struct { | ||
| Setting string | ||
| Value string | ||
| Reason string | ||
| UpdatedBy string | ||
| UpdatedTime string | ||
| } | ||
|
|
||
| func parseTaskQueueType(input string) (enums.TaskQueueType, error) { | ||
| switch input { | ||
| case "", "workflow": | ||
| return enums.TASK_QUEUE_TYPE_WORKFLOW, nil | ||
| case "activity": | ||
| return enums.TASK_QUEUE_TYPE_ACTIVITY, nil | ||
| case "nexus": | ||
| return enums.TASK_QUEUE_TYPE_NEXUS, nil | ||
| default: | ||
| return enums.TASK_QUEUE_TYPE_WORKFLOW, fmt.Errorf( | ||
| "invalid task queue type: %s. Must be one of: workflow, activity, nexus", input) | ||
| } | ||
| } | ||
|
|
||
| func buildRateLimitConfigRow(setting string, rl *taskqueue.RateLimitConfig, format string) configRow { | ||
| value := "Not Set" | ||
| reason := "" | ||
| updatedBy := "" | ||
| updatedTime := "" | ||
|
|
||
| if rl.RateLimit != nil && rl.RateLimit.RequestsPerSecond > 0 { | ||
| value = fmt.Sprintf(format, rl.RateLimit.RequestsPerSecond) | ||
| } | ||
|
|
||
| if rl.Metadata != nil { | ||
| if rl.Metadata.Reason != "" { | ||
| reason = truncateString(rl.Metadata.Reason, 50) | ||
| } | ||
| if rl.Metadata.UpdateIdentity != "" { | ||
| updatedBy = truncateString(rl.Metadata.UpdateIdentity, 50) | ||
| } | ||
| if rl.Metadata.UpdateTime != nil { | ||
| updateTime := rl.Metadata.UpdateTime.AsTime() | ||
| updatedTime = updateTime.Format(time.RFC3339) | ||
| } | ||
| } | ||
|
|
||
| return configRow{ | ||
| Setting: setting, | ||
| Value: value, | ||
| Reason: reason, | ||
| UpdatedBy: updatedBy, | ||
| UpdatedTime: updatedTime, | ||
| } | ||
| } | ||
|
|
||
| // printTaskQueueConfig is a shared function to print task queue configuration | ||
| // This can be used by both the config get command and the describe command | ||
| func printTaskQueueConfig(cctx *CommandContext, config *taskqueue.TaskQueueConfig) error { | ||
| // For JSON, we'll just dump the proto | ||
| if cctx.JSONOutput { | ||
| return cctx.Printer.PrintStructured(config, printer.StructuredOptions{}) | ||
| } | ||
|
|
||
| // For text, we will use a table | ||
| var configRows []configRow | ||
|
|
||
| // Queue Rate Limit | ||
| if config.QueueRateLimit != nil { | ||
| configRows = append(configRows, buildRateLimitConfigRow("Queue Rate Limit", config.QueueRateLimit, "%.2f rps")) | ||
| } | ||
|
|
||
| // Fairness Key Rate Limit Default | ||
| if config.FairnessKeysRateLimitDefault != nil { | ||
| configRows = append(configRows, buildRateLimitConfigRow("Fairness Key Rate Limit Default", config.FairnessKeysRateLimitDefault, "%.2f rps")) | ||
| } | ||
|
|
||
| // Print the config table | ||
| if len(configRows) > 0 { | ||
| // Always show truncation note, regardless of actual truncation | ||
| cctx.Printer.Println(color.YellowString("Note: Long content may be truncated. Use --output json for full details.")) | ||
|
|
||
| return cctx.Printer.PrintStructured(configRows, printer.StructuredOptions{ | ||
| Table: &printer.TableOptions{}, | ||
| }) | ||
| } | ||
|
|
||
| return nil | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, maybe it's time to remove this client-side fan-out feature? we have Describe doing fan-out now. or is that just for [deprecated] enhanced mode?
if we do keep client-side fan-out, I think we should either not ReportConfig on the ones other than the root, or disallow partition count > 1 with ReportConfig.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The legacy version of DescribeTaskQueue does not do fanout the fanout happens only in the enhanced version.
Reading the data from config is not that expensive do we need to add this additional check?