runservice scheduler: choose scheduler only if it has capacity

This commit is contained in:
Simone Gotti 2019-04-17 20:59:28 +02:00
parent 1ac139434e
commit 9c74b4ddc1
2 changed files with 8 additions and 0 deletions

View File

@ -182,6 +182,9 @@ var defaultConfig = Config{
RunServiceScheduler: RunServiceScheduler{ RunServiceScheduler: RunServiceScheduler{
RunCacheExpireInterval: 7 * 24 * time.Hour, RunCacheExpireInterval: 7 * 24 * time.Hour,
}, },
RunServiceExecutor: RunServiceExecutor{
ActiveTasksLimit: 2,
},
} }
func Parse(configFile string) (*Config, error) { func Parse(configFile string) (*Config, error) {

View File

@ -293,6 +293,11 @@ func (s *Scheduler) chooseExecutor(ctx context.Context, rct *types.RunConfigTask
if e.Labels["arch"] != string(rct.Runtime.Arch) { if e.Labels["arch"] != string(rct.Runtime.Arch) {
continue continue
} }
if e.ActiveTasksLimit != 0 {
if e.ActiveTasks >= e.ActiveTasksLimit {
continue
}
}
} }
return e, nil return e, nil