Skip to content

Commit

Permalink
add shm_size based on ShmSize
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-burhans committed Feb 28, 2024
1 parent 631af8f commit 47b1d58
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/galaxy/tool_util/deps/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions lib/galaxy/tool_util/xsd/galaxy.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -7269,6 +7269,11 @@ and ``bibtex`` are the only supported options.</xs:documentation>
<xs:documentation xml:lang="en">Maximum CUDA device count, if runtime allows it (not yet implemented in Galaxy).</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="shm_size">
<xs:annotation>
<xs:documentation xml:lang="en"><![CDATA[Size of /dev/shm. The format is `<number><unit>`. <number> 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`.]]></xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ContainerType">
Expand Down
1 change: 1 addition & 0 deletions test/functional/tools/resource_requirements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<resource type="gpu_memory_min">4042</resource>
<resource type="cuda_device_count_min">1</resource>
<resource type="cuda_device_count_max">2</resource>
<resource type="shm_size">67108864</resource>
</requirements>
<command><![CDATA[
echo "\$GALAXY_SLOTS" > $output
Expand Down
10 changes: 9 additions & 1 deletion test/unit/tool_util/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<resource type="gpu_memory_min">4042</resource>
<resource type="cuda_device_count_min">1</resource>
<resource type="cuda_device_count_max">2</resource>
<resource type="shm_size">67108864</resource>
</requirements>
<outputs>
<data name="out1" format="bam" from_work_dir="out1.bam" />
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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() == {
Expand All @@ -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())
Expand Down

0 comments on commit 47b1d58

Please sign in to comment.