Skip to content

Commit

Permalink
Revert "Batch operation rate limit" (#378)
Browse files Browse the repository at this point in the history
Reverts #366 - but leaving in the dependency updates.

It was merged too early; I'll bring it back when the new Server release
is available.
  • Loading branch information
stephanos authored Nov 6, 2023
1 parent b96845c commit cdbe10e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 34 deletions.
8 changes: 0 additions & 8 deletions batch/batch_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ func ListBatchJobs(c *cli.Context) error {
// BatchTerminate terminate a list of workflows
func BatchTerminate(c *cli.Context) error {
operator := common.GetCurrentUserFromEnv()
rps := float32(c.Float64(common.FlagRPS))

req := workflowservice.StartBatchOperationRequest{
MaxOperationsPerSecond: rps,
Operation: &workflowservice.StartBatchOperationRequest_TerminationOperation{
TerminationOperation: &batch.BatchOperationTermination{
Identity: operator,
Expand All @@ -100,10 +98,8 @@ func BatchTerminate(c *cli.Context) error {
// BatchCancel cancel a list of workflows
func BatchCancel(c *cli.Context) error {
operator := common.GetCurrentUserFromEnv()
rps := float32(c.Float64(common.FlagRPS))

req := workflowservice.StartBatchOperationRequest{
MaxOperationsPerSecond: rps,
Operation: &workflowservice.StartBatchOperationRequest_CancellationOperation{
CancellationOperation: &batch.BatchOperationCancellation{
Identity: operator,
Expand All @@ -118,14 +114,12 @@ func BatchCancel(c *cli.Context) error {
func BatchSignal(c *cli.Context) error {
signalName := c.String(common.FlagName)
operator := common.GetCurrentUserFromEnv()
rps := float32(c.Float64(common.FlagRPS))
input, err := common.ProcessJSONInput(c)
if err != nil {
return err
}

req := workflowservice.StartBatchOperationRequest{
MaxOperationsPerSecond: rps,
Operation: &workflowservice.StartBatchOperationRequest_SignalOperation{
SignalOperation: &batch.BatchOperationSignal{
Signal: signalName,
Expand All @@ -141,10 +135,8 @@ func BatchSignal(c *cli.Context) error {
// BatchDelete delete a list of workflows
func BatchDelete(c *cli.Context) error {
operator := common.GetCurrentUserFromEnv()
rps := float32(c.Float64(common.FlagRPS))

req := workflowservice.StartBatchOperationRequest{
MaxOperationsPerSecond: rps,
Operation: &workflowservice.StartBatchOperationRequest_DeletionOperation{
DeletionOperation: &batch.BatchOperationDeletion{
Identity: operator,
Expand Down
5 changes: 2 additions & 3 deletions common/defs-flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ const (
FlagUpdateIDDefinition = "UpdateID to check the result of an update (either UpdateID or Update handler name should be passed)"
FlagCancelWorkflow = "Cancel Workflow Execution with given Workflow Id."
FlagWorkflowIDTerminate = "Terminate Workflow Execution with given Workflow Id."
FlagRPSDefinition = "Limit for batch operation's requests per second."
FlagQueryCancel = "Cancel Workflow Executions with given List Filter."
FlagQueryDelete = "Delete Workflow Executions with given List Filter."
FlagQuerySignal = "Signal Workflow Executions with given List Filter."
FlagQueryReset = "Reset Workflow Executions with given List Filter"
FlagQuerySignal = "Signal Workflow Executions with given List List Filter."
FlagQueryTerminate = "Terminate Workflow Executions with given List Filter."
FlagEventIDDefinition = "The Event Id for any Event after WorkflowTaskStarted you want to reset to (exclusive). It can be WorkflowTaskCompleted, WorkflowTaskFailed or others."
FlagQueryResetBatch = "Visibility Query of Search Attributes describing the Workflow Executions to reset. See https://docs.temporal.io/docs/tctl/workflow/list#--query."
FlagInputFileReset = "Input file that specifies Workflow Executions to reset. Each line contains one Workflow Id as the base Run and, optionally, a Run Id."
FlagExcludeFileDefinition = "Input file that specifies Workflow Executions to exclude from a reset."
FlagInputSeparatorDefinition = "Separator for the input file. The default is a tab (`\t`)."
Expand Down
25 changes: 2 additions & 23 deletions workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ func NewWorkflowCommands() []*cli.Command {
Usage: common.FlagQuerySignal,
Category: common.CategoryMain,
},
&cli.Float64Flag{
Name: common.FlagRPS,
Usage: common.FlagRPSDefinition,
Category: common.CategoryMain,
},
&cli.StringFlag{
Name: common.FlagName,
Usage: common.FlagSignalName,
Expand Down Expand Up @@ -232,11 +227,6 @@ func NewWorkflowCommands() []*cli.Command {
Usage: common.FlagQueryCancel,
Category: common.CategoryMain,
},
&cli.Float64Flag{
Name: common.FlagRPS,
Usage: common.FlagRPSDefinition,
Category: common.CategoryMain,
},
&cli.StringFlag{
Name: common.FlagReason,
Usage: common.FlagReasonDefinition,
Expand Down Expand Up @@ -276,11 +266,6 @@ func NewWorkflowCommands() []*cli.Command {
Usage: common.FlagQueryTerminate,
Category: common.CategoryMain,
},
&cli.Float64Flag{
Name: common.FlagRPS,
Usage: common.FlagRPSDefinition,
Category: common.CategoryMain,
},
&cli.StringFlag{
Name: common.FlagReason,
Usage: common.FlagReasonDefinition,
Expand Down Expand Up @@ -320,11 +305,6 @@ func NewWorkflowCommands() []*cli.Command {
Usage: common.FlagQueryDelete,
Category: common.CategoryMain,
},
&cli.Float64Flag{
Name: common.FlagRPS,
Usage: common.FlagRPSDefinition,
Category: common.CategoryMain,
},
&cli.StringFlag{
Name: common.FlagReason,
Usage: common.FlagReasonDefinition,
Expand Down Expand Up @@ -381,10 +361,9 @@ func NewWorkflowCommands() []*cli.Command {
&cli.StringFlag{
Name: common.FlagQuery,
Aliases: common.FlagQueryAlias,
Usage: common.FlagQueryReset,
Usage: common.FlagQueryResetBatch,
Category: common.CategoryMain,
},
&cli.StringFlag{
}, &cli.StringFlag{
Name: common.FlagInputFile,
Usage: common.FlagInputFileReset,
Category: common.CategoryMain,
Expand Down

0 comments on commit cdbe10e

Please sign in to comment.