X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/cf4c25824e15e3b9a7c1439ab3aff17d8be52630..a3fdc9d5430346368939904f10737317433c2867:/lib/dispatchcloud/container/queue.go diff --git a/lib/dispatchcloud/container/queue.go b/lib/dispatchcloud/container/queue.go index 938ef915f2..ab686e85c1 100644 --- a/lib/dispatchcloud/container/queue.go +++ b/lib/dispatchcloud/container/queue.go @@ -233,6 +233,11 @@ func (cq *Queue) delEnt(uuid string, state arvados.ContainerState) { // 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 @@ -490,6 +495,16 @@ func (cq *Queue) fetchAll(initialParams arvados.ResourceListParams) ([]arvados.C break } + // Conserve memory by deleting mounts that aren't + // relevant to choosing the instance type. + for _, c := range list.Items { + for path, mnt := range c.Mounts { + if mnt.Kind != "tmp" { + delete(c.Mounts, path) + } + } + } + results = append(results, list.Items...) if len(params.Order) == 1 && params.Order == "uuid" { params.Filters = append(initialParams.Filters, arvados.Filter{"uuid", ">", list.Items[len(list.Items)-1].UUID})