feat: add trainer config in scheduler (#2214)

Signed-off-by: MinH-09 <2107139596@qq.com>
This commit is contained in:
MinH-09 2023-03-27 22:50:41 +08:00 committed by Gaius
parent 7a1ae0a2ee
commit 1994765fce
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
3 changed files with 17 additions and 0 deletions

View File

@ -69,6 +69,9 @@ type Config struct {
// NetworkTopology configuration. // NetworkTopology configuration.
NetworkTopology NetworkTopologyConfig `yaml:"networkTopology" mapstructure:"networkTopology"` NetworkTopology NetworkTopologyConfig `yaml:"networkTopology" mapstructure:"networkTopology"`
// Trainer configuration.
Trainer TrainerConfig `yaml:"trainer" mapstructure:"trainer"`
} }
type ServerConfig struct { type ServerConfig struct {
@ -320,6 +323,11 @@ type ProbeConfig struct {
SyncCount int `mapstructure:"syncCount" yaml:"syncCount"` SyncCount int `mapstructure:"syncCount" yaml:"syncCount"`
} }
type TrainerConfig struct {
// Enable trainer service.
Enable bool `yaml:"enable" mapstructure:"enable"`
}
// New default configuration. // New default configuration.
func New() *Config { func New() *Config {
return &Config{ return &Config{
@ -399,6 +407,9 @@ func New() *Config {
SyncCount: DefaultProbeSyncCount, SyncCount: DefaultProbeSyncCount,
}, },
}, },
Trainer: TrainerConfig{
Enable: false,
},
} }
} }

View File

@ -165,6 +165,9 @@ func TestConfig_Load(t *testing.T) {
SyncCount: 50, SyncCount: 50,
}, },
}, },
Trainer: TrainerConfig{
Enable: false,
},
} }
schedulerConfigYAML := &Config{} schedulerConfigYAML := &Config{}

View File

@ -87,3 +87,6 @@ networkTopology:
queueLength: 5 queueLength: 5
syncInterval: 30s syncInterval: 30s
syncCount: 50 syncCount: 50
trainer:
enable: false