support set chaos max task number

This commit is contained in:
barnettZQG 2019-12-02 16:30:09 +08:00
parent 4314844781
commit a09142d088
2 changed files with 7 additions and 2 deletions

View File

@ -72,7 +72,12 @@ func NewManager(conf option.Config, mqc mqclient.MQClient) (Manager, error) {
if err != nil {
return nil, err
}
maxConcurrentTask := runtime.NumCPU() * 2
var maxConcurrentTask int
if conf.MaxTasks == 0 {
maxConcurrentTask = runtime.NumCPU() * 2
} else {
maxConcurrentTask = conf.MaxTasks
}
ctx, cancel := context.WithCancel(context.Background())
logrus.Infof("The maximum number of concurrent build tasks supported by the current node is %d", maxConcurrentTask)
return &exectorManager{

View File

@ -72,7 +72,7 @@ func (a *Builder) AddFlags(fs *pflag.FlagSet) {
fs.StringVar(&a.MysqlConnectionInfo, "mysql", "root:admin@tcp(127.0.0.1:3306)/region", "mysql db connection info")
fs.StringSliceVar(&a.EventLogServers, "event-servers", []string{"127.0.0.1:6366"}, "event log server address. simple lb")
fs.StringVar(&a.KubeConfig, "kube-config", "/opt/rainbond/etc/kubernetes/kubecfg/admin.kubeconfig", "kubernetes api server config file")
fs.IntVar(&a.MaxTasks, "max-tasks", 50, "the max tasks for per node")
fs.IntVar(&a.MaxTasks, "max-tasks", 0, "Maximum number of simultaneous build tasksIf set to 0, the maximum limit is twice the number of CPU cores")
fs.IntVar(&a.APIPort, "api-port", 3228, "the port for api server")
fs.StringVar(&a.MQAPI, "mq-api", "127.0.0.1:6300", "acp_mq api")
fs.StringVar(&a.RunMode, "run", "sync", "sync data when worker start")