20602: Attach assigned priority to response log entry.
[arvados.git] / lib / dispatchcloud / scheduler / scheduler.go
index 4644dc4ea4db00782b38589f546f5cb22d577e88..21510ee091110768c116e2d77f39be18850eefee 100644 (file)
@@ -48,6 +48,7 @@ type Scheduler struct {
 
        last503time    time.Time // last time API responded 503
        maxConcurrency int       // dynamic container limit (0 = unlimited), see runQueue()
+       maxSupervisors int       // maximum number of "supervisor" containers (these are containers who's main job is to launch other containers, e.g. workflow runners)
 
        mContainersAllocatedNotStarted   prometheus.Gauge
        mContainersNotAllocatedOverQuota prometheus.Gauge
@@ -60,7 +61,7 @@ type Scheduler struct {
 //
 // Any given queue and pool should not be used by more than one
 // scheduler at a time.
-func New(ctx context.Context, client *arvados.Client, queue ContainerQueue, pool WorkerPool, reg *prometheus.Registry, staleLockTimeout, queueUpdateInterval time.Duration) *Scheduler {
+func New(ctx context.Context, client *arvados.Client, queue ContainerQueue, pool WorkerPool, reg *prometheus.Registry, staleLockTimeout, queueUpdateInterval time.Duration, maxSupervisors int) *Scheduler {
        sch := &Scheduler{
                logger:              ctxlog.FromContext(ctx),
                client:              client,
@@ -73,6 +74,7 @@ func New(ctx context.Context, client *arvados.Client, queue ContainerQueue, pool
                stop:                make(chan struct{}),
                stopped:             make(chan struct{}),
                uuidOp:              map[string]string{},
+               maxSupervisors:      maxSupervisors,
        }
        sch.registerMetrics(reg)
        return sch