@@ -18,6 +18,7 @@ import (
1818 "github.com/uber/cadence/common/clock"
1919 "github.com/uber/cadence/common/log"
2020 "github.com/uber/cadence/service/sharddistributor/canary"
21+ canaryConfig "github.com/uber/cadence/service/sharddistributor/canary/config"
2122 "github.com/uber/cadence/service/sharddistributor/canary/executors"
2223 "github.com/uber/cadence/service/sharddistributor/client/clientcommon"
2324 "github.com/uber/cadence/service/sharddistributor/client/executorclient"
@@ -32,6 +33,7 @@ const (
3233 defaultFixedNamespace = "shard-distributor-canary"
3334 defaultEphemeralNamespace = "shard-distributor-canary-ephemeral"
3435 defaultCanaryGRPCPort = 7953 // Port for canary to receive ping requests
36+ defaultNumExecutors = 1
3537
3638 shardDistributorServiceName = "cadence-shard-distributor"
3739)
@@ -42,10 +44,14 @@ func runApp(c *cli.Context) {
4244 ephemeralNamespace := c .String ("ephemeral-namespace" )
4345 canaryGRPCPort := c .Int ("canary-grpc-port" )
4446
45- fx .New (opts (fixedNamespace , ephemeralNamespace , endpoint , canaryGRPCPort )).Run ()
47+ numExecutors := c .Int ("num-executors" )
48+ numFixedExecutors := max (c .Int ("num-fixed-executors" ), numExecutors )
49+ numEphemeralxecutors := max (c .Int ("num-ephemeral-executors" ), numExecutors )
50+
51+ fx .New (opts (fixedNamespace , ephemeralNamespace , endpoint , canaryGRPCPort , numFixedExecutors , numEphemeralxecutors )).Run ()
4652}
4753
48- func opts (fixedNamespace , ephemeralNamespace , endpoint string , canaryGRPCPort int ) fx.Option {
54+ func opts (fixedNamespace , ephemeralNamespace , endpoint string , canaryGRPCPort int , numFixedExecutors , numEphemeral int ) fx.Option {
4955 configuration := clientcommon.Config {
5056 Namespaces : []clientcommon.NamespaceConfig {
5157 {Namespace : fixedNamespace , HeartBeatInterval : 1 * time .Second , MigrationMode : config .MigrationModeONBOARDED },
@@ -130,7 +136,18 @@ func opts(fixedNamespace, ephemeralNamespace, endpoint string, canaryGRPCPort in
130136 }),
131137
132138 // Include the canary module - it will set up spectator peer choosers and canary client
133- canary .Module (canary.NamespacesNames {FixedNamespace : fixedNamespace , EphemeralNamespace : ephemeralNamespace , ExternalAssignmentNamespace : executors .ExternalAssignmentNamespace , SharddistributorServiceName : shardDistributorServiceName }),
139+ canary .Module (canary.NamespacesNames {
140+ FixedNamespace : fixedNamespace ,
141+ EphemeralNamespace : ephemeralNamespace ,
142+ ExternalAssignmentNamespace : executors .ExternalAssignmentNamespace ,
143+ SharddistributorServiceName : shardDistributorServiceName ,
144+ Config : canaryConfig.Config {
145+ Canary : canaryConfig.CanaryConfig {
146+ NumFixedExecutors : numFixedExecutors ,
147+ NumEphemeralExecutors : numEphemeral ,
148+ },
149+ },
150+ }),
134151 )
135152}
136153
@@ -166,6 +183,21 @@ func buildCLI() *cli.App {
166183 Value : defaultCanaryGRPCPort ,
167184 Usage : "port for canary to receive ping requests" ,
168185 },
186+ & cli.IntFlag {
187+ Name : "num-executors" ,
188+ Value : defaultNumExecutors ,
189+ Usage : "number of executors for fixed and ephemeral to start. Overrides num-fixed-executors and num-ephemeral-executors flags" ,
190+ },
191+ & cli.IntFlag {
192+ Name : "num-fixed-executors" ,
193+ Value : defaultNumExecutors ,
194+ Usage : "number of executors of fixed namespace to start. Don't use with num-executors" ,
195+ },
196+ & cli.IntFlag {
197+ Name : "num-ephemeral-executors" ,
198+ Value : defaultNumExecutors ,
199+ Usage : "number of executors of ephemeral namespace to start. Don't use with num-executors" ,
200+ },
169201 },
170202 Action : func (c * cli.Context ) error {
171203 runApp (c )
0 commit comments