[ARVADOS] created: 1.3.0-1997-g6162a7fc5

Git user git at public.arvados.org
Thu Dec 19 04:41:41 UTC 2019


        at  6162a7fc5b213446b808313770d0d7e491fa5723 (commit)


commit 6162a7fc5b213446b808313770d0d7e491fa5723
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Wed Dec 18 23:41:21 2019 -0500

    15942: Fix attempt to run container after deciding it cannot run.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/lib/dispatchcloud/container/queue.go b/lib/dispatchcloud/container/queue.go
index f684105c1..21b41ec4d 100644
--- a/lib/dispatchcloud/container/queue.go
+++ b/lib/dispatchcloud/container/queue.go
@@ -343,12 +343,19 @@ func (cq *Queue) updateWithResp(uuid string, resp arvados.Container) {
 	if cq.dontupdate != nil {
 		cq.dontupdate[uuid] = struct{}{}
 	}
-	if ent, ok := cq.current[uuid]; !ok {
-		cq.addEnt(uuid, resp)
-	} else {
-		ent.Container.State, ent.Container.Priority, ent.Container.LockedByUUID = resp.State, resp.Priority, resp.LockedByUUID
-		cq.current[uuid] = ent
+	ent, ok := cq.current[uuid]
+	if !ok {
+		// Container is not in queue (e.g., it was not added
+		// because there is no suitable instance type, and
+		// we're just locking/updating it in order to set an
+		// error message). No need to add it, and we don't
+		// necessarily have enough information to add it here
+		// anyway because lock/unlock responses don't include
+		// runtime_constraints.
+		return
 	}
+	ent.Container.State, ent.Container.Priority, ent.Container.LockedByUUID = resp.State, resp.Priority, resp.LockedByUUID
+	cq.current[uuid] = ent
 	cq.notify()
 }
 
diff --git a/lib/dispatchcloud/container/queue_test.go b/lib/dispatchcloud/container/queue_test.go
index b6e867821..085e98a5f 100644
--- a/lib/dispatchcloud/container/queue_test.go
+++ b/lib/dispatchcloud/container/queue_test.go
@@ -117,11 +117,10 @@ func (suite *IntegrationSuite) TestCancelIfNoInstanceType(c *check.C) {
 	c.Check(err, check.IsNil)
 	c.Check(ctr.State, check.Equals, arvados.ContainerStateQueued)
 
-	cq.Update()
-
 	// Wait for the cancel operation to take effect. Container
 	// will have state=Cancelled or just disappear from the queue.
 	suite.waitfor(c, time.Second, func() bool {
+		cq.Update()
 		err := client.RequestAndDecode(&ctr, "GET", "arvados/v1/containers/"+arvadostest.QueuedContainerUUID, nil, nil)
 		return err == nil && ctr.State == arvados.ContainerStateCancelled
 	})

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list