[arvados] updated: 2.6.0-472-ge4d51d4e2

git repository hosting git at public.arvados.org
Fri Aug 11 14:20:02 UTC 2023


Summary of changes:
 lib/dispatchcloud/scheduler/run_queue.go | 41 +++++++++++++++++++++++++-------
 1 file changed, 33 insertions(+), 8 deletions(-)

       via  e4d51d4e25376c44d200eea30a6d2b90d073a0bf (commit)
       via  b3598b8b96ab908cde2de93467961a45dbb7787a (commit)
      from  4c36c40047be255a2819adeca44c5f1fea860bad (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e4d51d4e25376c44d200eea30a6d2b90d073a0bf
Author: Tom Clegg <tom at curii.com>
Date:   Fri Aug 11 10:17:30 2023 -0400

    20457: Don't lock-cycle next-in-line ctr while waiting for quota.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/dispatchcloud/scheduler/run_queue.go b/lib/dispatchcloud/scheduler/run_queue.go
index d3d6b7e7b..6a717bf44 100644
--- a/lib/dispatchcloud/scheduler/run_queue.go
+++ b/lib/dispatchcloud/scheduler/run_queue.go
@@ -253,7 +253,28 @@ tryrun:
 		// we're at quota (but if they have already been
 		// scheduled and they're loading docker images etc.,
 		// let them run).
-		for _, ctr := range append(overmaxsuper, overquota...) {
+		var unlock []container.QueueEnt
+		unlock = append(unlock, overmaxsuper...)
+		if totalInstances > 0 && len(overquota) > 1 {
+			// We don't unlock the next-in-line container
+			// when at quota.  This avoids a situation
+			// where our "at quota" state expires, we lock
+			// the next container and try to create an
+			// instance, the cloud provider still returns
+			// a quota error, we unlock the container, and
+			// we repeat this until the container reaches
+			// its limit of lock/unlock cycles.
+			unlock = append(unlock, overquota[1:]...)
+		} else {
+			// However, if totalInstances is 0 and we're
+			// still getting quota errors, then the
+			// next-in-line container is evidently not
+			// possible to run, so we should let it
+			// exhaust its lock/unlock cycles and
+			// eventually cancel, to avoid starvation.
+			unlock = append(unlock, overquota...)
+		}
+		for _, ctr := range unlock {
 			ctr := ctr.Container
 			_, toolate := running[ctr.UUID]
 			if ctr.State == arvados.ContainerStateLocked && !toolate {

commit b3598b8b96ab908cde2de93467961a45dbb7787a
Author: Tom Clegg <tom at curii.com>
Date:   Fri Aug 11 10:12:25 2023 -0400

    20457: Fix total instances count.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/dispatchcloud/scheduler/run_queue.go b/lib/dispatchcloud/scheduler/run_queue.go
index 9817101bb..d3d6b7e7b 100644
--- a/lib/dispatchcloud/scheduler/run_queue.go
+++ b/lib/dispatchcloud/scheduler/run_queue.go
@@ -19,6 +19,11 @@ func (sch *Scheduler) runQueue() {
 	running := sch.pool.Running()
 	unalloc := sch.pool.Unallocated()
 
+	totalInstances := 0
+	for _, n := range sch.pool.CountWorkers() {
+		totalInstances += n
+	}
+
 	unsorted, _ := sch.queue.Entries()
 	sorted := make([]container.QueueEnt, 0, len(unsorted))
 	for _, ent := range unsorted {
@@ -92,11 +97,10 @@ func (sch *Scheduler) runQueue() {
 	if sch.maxInstances > 0 && sch.maxConcurrency > sch.maxInstances {
 		sch.maxConcurrency = sch.maxInstances
 	}
-	instances := len(running) + len(unalloc)
-	if sch.instancesWithinQuota > 0 && sch.instancesWithinQuota < instances {
+	if sch.instancesWithinQuota > 0 && sch.instancesWithinQuota < totalInstances {
 		// Evidently it is possible to run this many
 		// instances, so raise our estimate.
-		sch.instancesWithinQuota = instances
+		sch.instancesWithinQuota = totalInstances
 	}
 	if sch.pool.AtQuota() {
 		// Consider current workload to be the maximum
@@ -109,14 +113,14 @@ func (sch *Scheduler) runQueue() {
 		// supervisors when we reach the cloud-imposed quota
 		// (which may be based on # CPUs etc) long before the
 		// configured MaxInstances.
-		if sch.maxConcurrency == 0 || sch.maxConcurrency > instances {
-			if instances == 0 {
+		if sch.maxConcurrency == 0 || sch.maxConcurrency > totalInstances {
+			if totalInstances == 0 {
 				sch.maxConcurrency = 1
 			} else {
-				sch.maxConcurrency = instances
+				sch.maxConcurrency = totalInstances
 			}
 		}
-		sch.instancesWithinQuota = instances
+		sch.instancesWithinQuota = totalInstances
 	} else if sch.instancesWithinQuota > 0 && sch.maxConcurrency > sch.instancesWithinQuota+1 {
 		// Once we've hit a quota error and started tracking
 		// instancesWithinQuota (i.e., it's not zero), we

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list