From 4dd89646afe8f11adac2ce66f33889071f03d1a2 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 17 Apr 2019 15:51:20 +0200 Subject: [PATCH] runservice executor: report ActiveTasksLimit Add a config option to set the active tasks limit and report it. --- internal/services/config/config.go | 2 ++ internal/services/runservice/executor/executor.go | 9 +++++---- internal/services/runservice/types/types.go | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/services/config/config.go b/internal/services/config/config.go index faf6e7c..04cb4b0 100644 --- a/internal/services/config/config.go +++ b/internal/services/config/config.go @@ -82,6 +82,8 @@ type RunServiceExecutor struct { Web Web `yaml:"web"` Labels map[string]string `yaml:"labels"` + // ActiveTasksLimit is the max number of concurrent active tasks + ActiveTasksLimit int `yaml:"active_tasks_limit"` } type ConfigStore struct { diff --git a/internal/services/runservice/executor/executor.go b/internal/services/runservice/executor/executor.go index 473a475..adfc25d 100644 --- a/internal/services/runservice/executor/executor.go +++ b/internal/services/runservice/executor/executor.go @@ -663,10 +663,11 @@ func (e *Executor) sendExecutorStatus(ctx context.Context) error { labels["arch"] = arch executor := &types.Executor{ - ID: e.id, - ListenURL: e.listenURL, - Labels: labels, - ActiveTasks: activeTasks, + ID: e.id, + ListenURL: e.listenURL, + Labels: labels, + ActiveTasksLimit: e.c.ActiveTasksLimit, + ActiveTasks: activeTasks, } log.Debugf("send executor status: %s", util.Dump(executor)) diff --git a/internal/services/runservice/types/types.go b/internal/services/runservice/types/types.go index 860ff82..c8ac433 100644 --- a/internal/services/runservice/types/types.go +++ b/internal/services/runservice/types/types.go @@ -658,7 +658,8 @@ type Executor struct { 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 Revision int64 `json:"-"`