21123: Add container status API to cloud dispatcher.
[arvados.git] / lib / dispatchcloud / scheduler / scheduler.go
index 1db12279dfe55fb67c237ea11052b864d0e69d45..bc6574a21a538134c618320f9e97511b84d9b307 100644 (file)
@@ -9,6 +9,7 @@ package scheduler
 import (
        "context"
        "sync"
+       "sync/atomic"
        "time"
 
        "git.arvados.org/arvados.git/sdk/go/arvados"
@@ -46,16 +47,19 @@ type Scheduler struct {
        stop    chan struct{}
        stopped chan struct{}
 
-       last503time        time.Time // last time API responded 503
-       maxConcurrency     int       // dynamic container limit (0 = unlimited), see runQueue()
-       supervisorFraction float64   // maximum fraction of "supervisor" containers (these are containers who's main job is to launch other containers, e.g. workflow runners)
-       maxInstances       int       // maximum number of instances the pool will bring up (0 = unlimited)
+       last503time          time.Time // last time API responded 503
+       maxConcurrency       int       // dynamic container limit (0 = unlimited), see runQueue()
+       supervisorFraction   float64   // maximum fraction of "supervisor" containers (these are containers who's main job is to launch other containers, e.g. workflow runners)
+       maxInstances         int       // maximum number of instances the pool will bring up (0 = unlimited)
+       instancesWithinQuota int       // max concurrency achieved since last quota error (0 = no quota error yet)
 
        mContainersAllocatedNotStarted   prometheus.Gauge
        mContainersNotAllocatedOverQuota prometheus.Gauge
        mLongestWaitTimeSinceQueue       prometheus.Gauge
        mLast503Time                     prometheus.Gauge
        mMaxContainerConcurrency         prometheus.Gauge
+
+       lastQueue atomic.Value // stores a []QueueEnt
 }
 
 // New returns a new unstarted Scheduler.