Skip to content

Commit

Permalink
Do not pass yarpc options in CLI (cadence-workflow#4712)
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius authored Jan 27, 2022
1 parent ceacad0 commit a964dfb
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 107 deletions.
10 changes: 0 additions & 10 deletions common/client/versionChecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,6 @@ func GetFeatureFlagsFromHeader(call *yarpc.Call) shared.FeatureFlags {
return shared.FeatureFlags{}
}

// GetDefaultCLIYarpcCallOptions returns default yarpc options to use when sending rpc requests
func GetDefaultCLIYarpcCallOptions() []yarpc.CallOption {
return []yarpc.CallOption{
yarpc.WithHeader(common.LibraryVersionHeaderName, "0.0.1"),
yarpc.WithHeader(common.FeatureVersionHeaderName, GoWorkerConsistentQueryVersion),
yarpc.WithHeader(common.ClientImplHeaderName, GoSDK),
yarpc.WithHeader(common.ClientFeatureFlagsHeaderName, FeatureFlagsHeader(DefaultCLIFeatureFlags)),
}
}

// NewVersionChecker constructs a new VersionChecker
func NewVersionChecker() VersionChecker {
supportedFeatures := map[string]map[string]version.Constraints{
Expand Down
5 changes: 4 additions & 1 deletion host/signal_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/pborman/uuid"
"go.uber.org/yarpc"

"github.com/uber/cadence/.gen/go/shared"
"github.com/uber/cadence/common"
"github.com/uber/cadence/common/client"
"github.com/uber/cadence/common/log/tag"
Expand Down Expand Up @@ -215,7 +216,9 @@ func (s *IntegrationSuite) TestSignalWorkflow() {
s.IsType(&types.EntityNotExistsError{}, err)

// Send signal by enabling WorkflowExecutionAlreadyCompletedError feature
err = signal(we.RunID, "failed signal 1.", nil, client.GetDefaultCLIYarpcCallOptions()...)
err = signal(we.RunID, "failed signal 1.", nil, yarpc.WithHeader(common.ClientFeatureFlagsHeaderName, client.FeatureFlagsHeader(shared.FeatureFlags{
WorkflowExecutionAlreadyCompletedErrorEnabled: common.BoolPtr(true),
})))
s.NotNil(err)
s.IsType(&types.WorkflowExecutionAlreadyCompletedError{}, err)
}
Expand Down
3 changes: 0 additions & 3 deletions host/taskpoller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/stretchr/testify/require"

"github.com/uber/cadence/common"
"github.com/uber/cadence/common/client"
"github.com/uber/cadence/common/log"
"github.com/uber/cadence/common/log/tag"
"github.com/uber/cadence/common/types"
Expand Down Expand Up @@ -271,7 +270,6 @@ Loop:
ForceCreateNewDecisionTask: forceCreateNewDecision,
QueryResults: getQueryResults(response.GetQueries(), queryResult),
},
client.GetDefaultCLIYarpcCallOptions()...,
)

return false, newTask, err
Expand Down Expand Up @@ -328,7 +326,6 @@ func (p *TaskPoller) HandlePartialDecision(response *types.PollForDecisionTaskRe
ReturnNewDecisionTask: true,
ForceCreateNewDecisionTask: true,
},
client.GetDefaultCLIYarpcCallOptions()...,
)

return newTask, err
Expand Down
5 changes: 2 additions & 3 deletions tools/cli/adminClusterCommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"github.com/uber/cadence/common"
"github.com/uber/cadence/service/worker/failovermanager"

cc "github.com/uber/cadence/common/client"
"github.com/uber/cadence/common/types"
)

Expand Down Expand Up @@ -61,7 +60,7 @@ func AdminAddSearchAttribute(c *cli.Context) {
SecurityToken: c.String(FlagSecurityToken),
}

err := adminClient.AddSearchAttribute(ctx, request, cc.GetDefaultCLIYarpcCallOptions()...)
err := adminClient.AddSearchAttribute(ctx, request)
if err != nil {
ErrorAndExit("Add search attribute failed.", err)
}
Expand Down Expand Up @@ -120,7 +119,7 @@ func AdminRebalanceStart(c *cli.Context) {
},
}

resp, err := client.StartWorkflowExecution(tcCtx, request, cc.GetDefaultCLIYarpcCallOptions()...)
resp, err := client.StartWorkflowExecution(tcCtx, request)
if err != nil {
ErrorAndExit("Failed to start failover workflow", err)
}
Expand Down
3 changes: 1 addition & 2 deletions tools/cli/adminCommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (

"github.com/uber/cadence/.gen/go/shared"
"github.com/uber/cadence/common"
cc "github.com/uber/cadence/common/client"
"github.com/uber/cadence/common/codec"
"github.com/uber/cadence/common/config"
"github.com/uber/cadence/common/log/loggerimpl"
Expand Down Expand Up @@ -187,7 +186,7 @@ func describeMutableState(c *cli.Context) *types.AdminDescribeWorkflowExecutionR
RunID: rid,
},
},
cc.GetDefaultCLIYarpcCallOptions()...)
)
if err != nil {
ErrorAndExit("Get workflow mutableState failed", err)
}
Expand Down
13 changes: 6 additions & 7 deletions tools/cli/adminFailoverCommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (

"github.com/uber/cadence/client/frontend"
"github.com/uber/cadence/common"
cc "github.com/uber/cadence/common/client"
"github.com/uber/cadence/common/types"
"github.com/uber/cadence/service/worker/failovermanager"
)
Expand Down Expand Up @@ -106,7 +105,7 @@ func AdminFailoverQuery(c *cli.Context) {
},
}

descResp, err := client.DescribeWorkflowExecution(tcCtx, request, cc.GetDefaultCLIYarpcCallOptions()...)
descResp, err := client.DescribeWorkflowExecution(tcCtx, request)
if err != nil {
ErrorAndExit("Failed to describe workflow", err)
}
Expand Down Expand Up @@ -137,7 +136,7 @@ func AdminFailoverAbort(c *cli.Context) {
Reason: reason,
}

err := client.TerminateWorkflowExecution(tcCtx, request, cc.GetDefaultCLIYarpcCallOptions()...)
err := client.TerminateWorkflowExecution(tcCtx, request)
if err != nil {
ErrorAndExit("Failed to abort failover workflow", err)
}
Expand Down Expand Up @@ -165,7 +164,7 @@ func AdminFailoverRollback(c *cli.Context) {
Identity: getCliIdentity(),
}

err := client.TerminateWorkflowExecution(tcCtx, request, cc.GetDefaultCLIYarpcCallOptions()...)
err := client.TerminateWorkflowExecution(tcCtx, request)
if err != nil {
ErrorAndExit("Failed to terminate failover workflow", err)
}
Expand Down Expand Up @@ -212,7 +211,7 @@ func query(
QueryType: failovermanager.QueryType,
},
}
queryResp, err := client.QueryWorkflow(tcCtx, request, cc.GetDefaultCLIYarpcCallOptions()...)
queryResp, err := client.QueryWorkflow(tcCtx, request)
if err != nil {
ErrorAndExit("Failed to query failover workflow", err)
}
Expand Down Expand Up @@ -318,7 +317,7 @@ func failoverStart(c *cli.Context, params *startParams) {
ErrorAndExit("Failed to serialize Failover Params", err)
}
request.Input = input
wf, err := client.StartWorkflowExecution(tcCtx, request, cc.GetDefaultCLIYarpcCallOptions()...)
wf, err := client.StartWorkflowExecution(tcCtx, request)
if err != nil {
ErrorAndExit("Failed to start failover workflow", err)
}
Expand Down Expand Up @@ -370,7 +369,7 @@ func executePauseOrResume(c *cli.Context, workflowID string, isPause bool) error
Identity: getCliIdentity(),
}

return client.SignalWorkflowExecution(tcCtx, request, cc.GetDefaultCLIYarpcCallOptions()...)
return client.SignalWorkflowExecution(tcCtx, request)
}

func validateStartParams(params *startParams) {
Expand Down
Loading

0 comments on commit a964dfb

Please sign in to comment.