// Caller must have lock.
func (cq *Queue) addEnt(uuid string, ctr arvados.Container) {
it, err := cq.chooseType(&ctr)
+
+ // Avoid wasting memory on a large Mounts attr (we don't need
+ // it after choosing type).
+ ctr.Mounts = nil
+
if err != nil && (ctr.State == arvados.ContainerStateQueued || ctr.State == arvados.ContainerStateLocked) {
// We assume here that any chooseType error is a hard
// error: it wouldn't help to try again, or to leave
func (suite *IntegrationSuite) TestGetLockUnlockCancel(c *check.C) {
typeChooser := func(ctr *arvados.Container) (arvados.InstanceType, error) {
+ c.Check(ctr.Mounts["/tmp"].Capacity, check.Equals, int64(24000000000))
return arvados.InstanceType{Name: "testType"}, nil
}
c.Check(ent.InstanceType.Name, check.Equals, "testType")
c.Check(ent.Container.State, check.Equals, arvados.ContainerStateQueued)
c.Check(ent.Container.Priority > 0, check.Equals, true)
+ // Mounts should be deleted to avoid wasting memory
+ c.Check(ent.Container.Mounts, check.IsNil)
ctr, ok := cq.Get(uuid)
c.Check(ok, check.Equals, true)