runservice executor: report ActiveTasksLimit

Add a config option to set the active tasks limit and report it.
This commit is contained in:
Simone Gotti 2019-04-17 15:51:20 +02:00
parent 455623e58a
commit 4dd89646af
3 changed files with 9 additions and 5 deletions

View File

@ -82,6 +82,8 @@ type RunServiceExecutor struct {
Web Web `yaml:"web"` Web Web `yaml:"web"`
Labels map[string]string `yaml:"labels"` Labels map[string]string `yaml:"labels"`
// ActiveTasksLimit is the max number of concurrent active tasks
ActiveTasksLimit int `yaml:"active_tasks_limit"`
} }
type ConfigStore struct { type ConfigStore struct {

View File

@ -663,10 +663,11 @@ func (e *Executor) sendExecutorStatus(ctx context.Context) error {
labels["arch"] = arch labels["arch"] = arch
executor := &types.Executor{ executor := &types.Executor{
ID: e.id, ID: e.id,
ListenURL: e.listenURL, ListenURL: e.listenURL,
Labels: labels, Labels: labels,
ActiveTasks: activeTasks, ActiveTasksLimit: e.c.ActiveTasksLimit,
ActiveTasks: activeTasks,
} }
log.Debugf("send executor status: %s", util.Dump(executor)) log.Debugf("send executor status: %s", util.Dump(executor))

View File

@ -658,7 +658,8 @@ type Executor struct {
Labels map[string]string `json:"labels,omitempty"` Labels map[string]string `json:"labels,omitempty"`
ActiveTasks int `json:"active_tasks,omitempty"` ActiveTasksLimit int `json:"active_tasks_limit,omitempty"`
ActiveTasks int `json:"active_tasks,omitempty"`
// internal values not saved // internal values not saved
Revision int64 `json:"-"` Revision int64 `json:"-"`