From 47b1d580259a842cf5dfb0295a3a8d981cc24238 Mon Sep 17 00:00:00 2001 From: Richard Burhans Date: Wed, 28 Feb 2024 11:51:53 -0600 Subject: [PATCH] add shm_size based on ShmSize --- lib/galaxy/tool_util/deps/requirements.py | 2 ++ lib/galaxy/tool_util/xsd/galaxy.xsd | 5 +++++ test/functional/tools/resource_requirements.xml | 1 + test/unit/tool_util/test_parsing.py | 10 +++++++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/tool_util/deps/requirements.py b/lib/galaxy/tool_util/deps/requirements.py index d2fbb249aa63..bfb02e0ea606 100644 --- a/lib/galaxy/tool_util/deps/requirements.py +++ b/lib/galaxy/tool_util/deps/requirements.py @@ -243,6 +243,7 @@ def __str__(self) -> str: "gpu_memory_min", "cuda_device_count_min", "cuda_device_count_max", + "shm_size", ] VALID_RESOURCE_TYPES = get_args(ResourceType) @@ -287,6 +288,7 @@ def resource_requirements_from_list(requirements: Iterable[Dict[str, Any]]) -> L "gpuMemoryMin": "gpu_memory_min", "cudaDeviceCountMin": "cuda_device_count_min", "cudaDeviceCountMax": "cuda_device_count_max", + "ShmSize": "shm_size", } rr = [] for r in requirements: diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd index 27cafa7f3bc2..475edb95532a 100644 --- a/lib/galaxy/tool_util/xsd/galaxy.xsd +++ b/lib/galaxy/tool_util/xsd/galaxy.xsd @@ -7269,6 +7269,11 @@ and ``bibtex`` are the only supported options. Maximum CUDA device count, if runtime allows it (not yet implemented in Galaxy). + + + `. must be greater than 0. Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you omit the unit, the default is bytes. If you omit the size entirely, the value is `64m`.]]> + + diff --git a/test/functional/tools/resource_requirements.xml b/test/functional/tools/resource_requirements.xml index 96a5641f7203..65a07fd785c9 100644 --- a/test/functional/tools/resource_requirements.xml +++ b/test/functional/tools/resource_requirements.xml @@ -11,6 +11,7 @@ 4042 1 2 + 67108864 $output diff --git a/test/unit/tool_util/test_parsing.py b/test/unit/tool_util/test_parsing.py index 25575348636a..46e226ba05bc 100644 --- a/test/unit/tool_util/test_parsing.py +++ b/test/unit/tool_util/test_parsing.py @@ -36,6 +36,7 @@ 4042 1 2 + 67108864 @@ -140,6 +141,8 @@ cuda_device_count_min: 1 - type: resource cuda_device_count_max: 2 + - type: resource + shm_size: 67108864 containers: - type: docker identifier: "awesome/bowtie" @@ -331,6 +334,7 @@ def test_requirements(self): assert resource_requirements[3].resource_type == "gpu_memory_min" assert resource_requirements[4].resource_type == "cuda_device_count_min" assert resource_requirements[5].resource_type == "cuda_device_count_max" + assert resource_requirements[6].resource_type == "shm_size" assert not resource_requirements[0].runtime_required def test_outputs(self): @@ -506,7 +510,7 @@ def test_requirements(self): "resolve_dependencies": False, "shell": "/bin/sh", } - assert len(resource_requirements) == 6 + assert len(resource_requirements) == 7 assert resource_requirements[0].to_dict() == {"resource_type": "cores_min", "value_or_expression": 1} assert resource_requirements[1].to_dict() == {"resource_type": "cuda_version_min", "value_or_expression": 10.2} assert resource_requirements[2].to_dict() == { @@ -522,6 +526,10 @@ def test_requirements(self): "resource_type": "cuda_device_count_max", "value_or_expression": 2, } + assert resource_requirements[6].to_dict() == { + "resource_type": "shm_size", + "value_or_expression": "67108864", + } def test_outputs(self): outputs, output_collections = self._tool_source.parse_outputs(object())