Merge pull request #1187 from rgasquet/feature/add-cpuset-option

Feature: add cpuset option
This commit is contained in:
Povilas Kanapickas 2025-04-21 22:49:08 +03:00 committed by GitHub
commit 150ab02446
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1 @@
- Add support for `cpuset`

View File

@ -1189,6 +1189,10 @@ async def container_to_args(compose, cnt, detached=True, no_deps=False):
if cnt.get("runtime"):
podman_args.extend(["--runtime", cnt["runtime"]])
cpuset = cnt.get("cpuset")
if cpuset is not None:
podman_args.extend(["--cpuset-cpus", cpuset])
# WIP: healthchecks are still work in progress
healthcheck = cnt.get("healthcheck", {})
if not isinstance(healthcheck, dict):

View File

@ -612,3 +612,21 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase):
"busybox",
],
)
async def test_cpuset(self):
c = create_compose_mock()
cnt = get_minimal_container()
cnt["cpuset"] = "0-1"
args = await container_to_args(c, cnt)
self.assertEqual(
args,
[
"--name=project_name_service_name1",
"-d",
"--network=bridge:alias=service_name",
"--cpuset-cpus",
"0-1",
"busybox",
],
)