Skip to content

Commit

Permalink
Revert "Update CLI to use grpc transport by default" (cadence-workflo…
Browse files Browse the repository at this point in the history
…w#6502)

* Revert "Update CLI to use grpc transport by default (cadence-workflow#6495)"

This reverts commit 55be200.
  • Loading branch information
dkrotx authored Nov 18, 2024
1 parent 0105e2d commit 040713d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 26 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ You can find a list of previous releases on the [github releases](https://github
## [Unreleased]
Global ratelimiter, see [detailed doc](https://github.com/uber/cadence/blob/master/common/quotas/global/doc.go)

Update CLI to use GRPC transport by default (originally tchannel).

## [1.2.13] - 2024-09-25
See [Release Note](https://github.com/uber/cadence/releases/tag/v1.2.13) for details

Expand Down
2 changes: 1 addition & 1 deletion tools/cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func NewCliApp(cf ClientFactory, opts ...CLIAppOptions) *cli.App {
&cli.StringFlag{
Name: FlagTransport,
Aliases: []string{"t"},
Usage: "optional argument for transport protocol format, either 'grpc' or 'tchannel'. Defaults to grpc if not provided",
Usage: "optional argument for transport protocol format, either 'grpc' or 'tchannel'. Defaults to tchannel if not provided",
EnvVars: []string{"CADENCE_CLI_TRANSPORT_PROTOCOL"},
},
&cli.StringFlag{
Expand Down
46 changes: 23 additions & 23 deletions tools/cli/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ func (b *clientFactory) ServerFrontendClient(c *cli.Context) (frontend.Client, e
return nil, commoncli.Problem("failed to create frontend client dependency", err)
}
clientConfig := b.dispatcher.ClientConfig(cadenceFrontendService)
if c.String(FlagTransport) == thriftTransport {
return thrift.NewFrontendClient(serverFrontend.New(clientConfig)), nil
if c.String(FlagTransport) == grpcTransport {
return grpcClient.NewFrontendClient(
apiv1.NewDomainAPIYARPCClient(clientConfig),
apiv1.NewWorkflowAPIYARPCClient(clientConfig),
apiv1.NewWorkerAPIYARPCClient(clientConfig),
apiv1.NewVisibilityAPIYARPCClient(clientConfig),
), nil
}
return grpcClient.NewFrontendClient(
apiv1.NewDomainAPIYARPCClient(clientConfig),
apiv1.NewWorkflowAPIYARPCClient(clientConfig),
apiv1.NewWorkerAPIYARPCClient(clientConfig),
apiv1.NewVisibilityAPIYARPCClient(clientConfig),
), nil
return thrift.NewFrontendClient(serverFrontend.New(clientConfig)), nil
}

// ServerAdminClient builds an admin client (based on server side thrift interface)
Expand All @@ -142,10 +142,10 @@ func (b *clientFactory) ServerAdminClient(c *cli.Context) (admin.Client, error)
return nil, commoncli.Problem("failed to create admin client dependency", err)
}
clientConfig := b.dispatcher.ClientConfig(cadenceFrontendService)
if c.String(FlagTransport) == thriftTransport {
return thrift.NewAdminClient(serverAdmin.New(clientConfig)), nil
if c.String(FlagTransport) == grpcTransport {
return grpcClient.NewAdminClient(adminv1.NewAdminAPIYARPCClient(clientConfig)), nil
}
return grpcClient.NewAdminClient(adminv1.NewAdminAPIYARPCClient(clientConfig)), nil
return thrift.NewAdminClient(serverAdmin.New(clientConfig)), nil
}

// ServerFrontendClientForMigration builds a frontend client (based on server side thrift interface)
Expand All @@ -155,15 +155,15 @@ func (b *clientFactory) ServerFrontendClientForMigration(c *cli.Context) (fronte
return nil, commoncli.Problem("failed to create frontend client dependency", err)
}
clientConfig := b.dispatcherMigration.ClientConfig(cadenceFrontendService)
if c.String(FlagTransport) == thriftTransport {
return thrift.NewFrontendClient(serverFrontend.New(clientConfig)), nil
if c.String(FlagTransport) == grpcTransport {
return grpcClient.NewFrontendClient(
apiv1.NewDomainAPIYARPCClient(clientConfig),
apiv1.NewWorkflowAPIYARPCClient(clientConfig),
apiv1.NewWorkerAPIYARPCClient(clientConfig),
apiv1.NewVisibilityAPIYARPCClient(clientConfig),
), nil
}
return grpcClient.NewFrontendClient(
apiv1.NewDomainAPIYARPCClient(clientConfig),
apiv1.NewWorkflowAPIYARPCClient(clientConfig),
apiv1.NewWorkerAPIYARPCClient(clientConfig),
apiv1.NewVisibilityAPIYARPCClient(clientConfig),
), nil
return thrift.NewFrontendClient(serverFrontend.New(clientConfig)), nil
}

// ServerAdminClientForMigration builds an admin client (based on server side thrift interface)
Expand All @@ -173,10 +173,10 @@ func (b *clientFactory) ServerAdminClientForMigration(c *cli.Context) (admin.Cli
return nil, commoncli.Problem("failed to create admin client dependency", err)
}
clientConfig := b.dispatcherMigration.ClientConfig(cadenceFrontendService)
if c.String(FlagTransport) == thriftTransport {
return thrift.NewAdminClient(serverAdmin.New(clientConfig)), nil
if c.String(FlagTransport) == grpcTransport {
return grpcClient.NewAdminClient(adminv1.NewAdminAPIYARPCClient(clientConfig)), nil
}
return grpcClient.NewAdminClient(adminv1.NewAdminAPIYARPCClient(clientConfig)), nil
return thrift.NewAdminClient(serverAdmin.New(clientConfig)), nil
}

// ElasticSearchClient builds an ElasticSearch client
Expand Down Expand Up @@ -235,7 +235,7 @@ func (b *clientFactory) ensureDispatcherForMigration(c *cli.Context) error {
}

func (b *clientFactory) newClientDispatcher(c *cli.Context, hostPortOverride string) (*yarpc.Dispatcher, error) {
shouldUseGrpc := c.String(FlagTransport) != thriftTransport
shouldUseGrpc := c.String(FlagTransport) == grpcTransport

hostPort := tchannelPort
if shouldUseGrpc {
Expand Down

0 comments on commit 040713d

Please sign in to comment.