[ARVADOS] created: 1.3.0-1768-gaea1693cf

Git user git at public.curoverse.com
Mon Oct 21 15:42:16 UTC 2019


        at  aea1693cfc6359a7f290797724ee989bc47b09e0 (commit)


commit aea1693cfc6359a7f290797724ee989bc47b09e0
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Mon Oct 21 11:41:23 2019 -0400

    15707: Forget about queued containers with priority=0.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/lib/dispatchcloud/scheduler/sync.go b/lib/dispatchcloud/scheduler/sync.go
index 78f099549..205ee5018 100644
--- a/lib/dispatchcloud/scheduler/sync.go
+++ b/lib/dispatchcloud/scheduler/sync.go
@@ -61,6 +61,13 @@ func (sch *Scheduler) sync() {
 				// preparing to run a container that
 				// has already been unlocked/requeued.
 				go sch.kill(uuid, fmt.Sprintf("state=%s", ent.Container.State))
+			} else if ent.Container.Priority == 0 {
+				sch.logger.WithFields(logrus.Fields{
+					"ContainerUUID": uuid,
+					"State":         ent.Container.State,
+					"Priority":      ent.Container.Priority,
+				}).Info("container on hold")
+				sch.queue.Forget(uuid)
 			}
 		case arvados.ContainerStateLocked:
 			if running && !exited.IsZero() && qUpdated.After(exited) {
diff --git a/lib/dispatchcloud/scheduler/sync_test.go b/lib/dispatchcloud/scheduler/sync_test.go
new file mode 100644
index 000000000..d62bd7c40
--- /dev/null
+++ b/lib/dispatchcloud/scheduler/sync_test.go
@@ -0,0 +1,56 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package scheduler
+
+import (
+	"context"
+	"time"
+
+	"git.curoverse.com/arvados.git/lib/dispatchcloud/test"
+	"git.curoverse.com/arvados.git/sdk/go/arvados"
+	"git.curoverse.com/arvados.git/sdk/go/ctxlog"
+	check "gopkg.in/check.v1"
+)
+
+// Ensure the scheduler expunges containers from the queue when they
+// are no longer relevant (completed and not running, queued with
+// priority 0, etc).
+func (*SchedulerSuite) TestForgetIrrelevantContainers(c *check.C) {
+	ctx := ctxlog.Context(context.Background(), ctxlog.TestLogger(c))
+	pool := stubPool{}
+	queue := test.Queue{
+		ChooseType: chooseType,
+		Containers: []arvados.Container{
+			{
+				UUID:     test.ContainerUUID(1),
+				Priority: 0,
+				State:    arvados.ContainerStateQueued,
+				RuntimeConstraints: arvados.RuntimeConstraints{
+					VCPUs: 1,
+					RAM:   1 << 30,
+				},
+			},
+			{
+				UUID:     test.ContainerUUID(2),
+				Priority: 12345,
+				State:    arvados.ContainerStateComplete,
+				RuntimeConstraints: arvados.RuntimeConstraints{
+					VCPUs: 1,
+					RAM:   1 << 30,
+				},
+			},
+		},
+	}
+	queue.Update()
+
+	ents, _ := queue.Entries()
+	c.Check(ents, check.HasLen, 1)
+
+	sch := New(ctx, &queue, &pool, time.Millisecond, time.Millisecond)
+	sch.sync()
+
+	ents, _ = queue.Entries()
+	c.Check(ents, check.HasLen, 0)
+}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list