20457: Don't keep non-"tmp" mounts in memory at all. 20457-logs-and-mem-usage
authorTom Clegg <tom@curii.com>
Mon, 1 May 2023 19:40:12 +0000 (15:40 -0400)
committerTom Clegg <tom@curii.com>
Mon, 1 May 2023 19:40:12 +0000 (15:40 -0400)
Only "tmp" mounts are relevant for dispatch.

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/dispatchcloud/container/queue.go

index 5f6fdefbd51052289407930bbd0aa14b0ae6039e..ab686e85c11cc5e94d9ec4af9ec57a093ba600cd 100644 (file)
@@ -495,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})