From ede1fe4b335eaac5f66b179b0c6a650075fd0445 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 28 Jan 2024 20:38:32 +0900 Subject: [PATCH] Allow binding storlet applications to specific CPUs or memory nodes Docker supports binding a container to specific cpu cores memory nodes. This introduces a few options to allow operators to limit resources used by storlet containers. Change-Id: Ifa734850f4284724a5ee06a172b81e04e5fb7015 --- storlets/gateway/gateways/docker/runtime.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storlets/gateway/gateways/docker/runtime.py b/storlets/gateway/gateways/docker/runtime.py index 9ace12e0..f3fa892d 100644 --- a/storlets/gateway/gateways/docker/runtime.py +++ b/storlets/gateway/gateways/docker/runtime.py @@ -255,6 +255,8 @@ class RunTimeSandbox(object): self.container_mem_limit = int(self.container_mem_limit) except TypeError: pass + self.container_cpuset_cpus = conf.get('container_cpuset_cpus') + self.container_cpuset_mems = conf.get('container_cpuset_mems') def ping(self): """ @@ -360,6 +362,8 @@ class RunTimeSandbox(object): cpu_period=self.container_cpu_period, cpu_quota=self.container_cpu_quota, mem_limit=self.container_mem_limit, + cpuset_cpus=self.container_cpuset_cpus, + cpuset_mems=self.container_cpuset_mems, labels={'managed_by': 'storlets'}) except docker.errors.ImageNotFound: msg = "Image %s is not found" % docker_image_name