shexec 2.6.0__tar.gz → 2.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shexec
3
- Version: 2.6.0
3
+ Version: 2.7.0
4
4
  Summary: Run a shell-type command over every file of an input tree: a ChRIS DS plugin on pfdo_run
5
5
  Home-page: https://github.com/FNNDSC/pl-shexec
6
6
  Author: FNNDSC
@@ -14,7 +14,7 @@ Dependencies:
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- __version__: str = "2.6.0"
17
+ __version__: str = "2.7.0"
18
18
 
19
19
  from shexec.models import (
20
20
  DirNode,
@@ -83,6 +83,9 @@ class PluginSpec:
83
83
  minMemory: the memory ChRIS reserves, as ``2Gi``.
84
84
  minCpu: the CPU ChRIS reserves, in millicores, as ``1000m``.
85
85
  minGpu: GPUs required; 0 for none.
86
+ maxGpu: GPUs a run may be given; 0 means as many as ``minGpu``. CUBE
87
+ refuses a description whose minimum exceeds its maximum, and
88
+ chris_plugin writes a maximum of 0 unless told otherwise.
86
89
  defaults: flag defaults, ``exec`` above all; a derived plugin's usual command.
87
90
  omit: engine flags this plugin does not offer, by destination name, as
88
91
  ``("threads", "threadsSplit")``. Each is removed from the parser, so
@@ -114,6 +117,7 @@ class PluginSpec:
114
117
  minMemory: str = "2Gi"
115
118
  minCpu: str = "1000m"
116
119
  minGpu: int = 0
120
+ maxGpu: int = 0
117
121
  defaults: dict[str, Any] = field(default_factory=dict)
118
122
  omit: tuple[str, ...] = ()
119
123
  chrisHidden: tuple[str, ...] = ()
@@ -243,6 +243,7 @@ def plugin_build(spec: PluginSpec, singleton: bool = True) -> Plugin:
243
243
  min_memory_limit=spec.minMemory,
244
244
  min_cpu_limit=spec.minCpu,
245
245
  min_gpu_limit=spec.minGpu,
246
+ max_gpu_limit=max(spec.maxGpu, spec.minGpu),
246
247
  singleton=register,
247
248
  )(timedBody)
248
249
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shexec
3
- Version: 2.6.0
3
+ Version: 2.7.0
4
4
  Summary: Run a shell-type command over every file of an input tree: a ChRIS DS plugin on pfdo_run
5
5
  Home-page: https://github.com/FNNDSC/pl-shexec
6
6
  Author: FNNDSC
@@ -8,6 +8,7 @@ import json
8
8
  from pathlib import Path
9
9
 
10
10
  import pytest
11
+ from chris_plugin import _registration as chris_registration
11
12
  from chris_plugin.parameters import serialize
12
13
 
13
14
  from shexec import Plugin, PluginSpec, plugin_build
@@ -179,3 +180,17 @@ def test_threadsCap_note() -> None:
179
180
  assert "not capped" in threads_cap(4, 16 * gib, None).note()
180
181
  assert threads_cap(0, 16 * gib, MemoryLimit(1, "cgroup")).allowed == 0
181
182
  assert threads_cap(4, 0, MemoryLimit(1, "cgroup")).allowed == 4
183
+
184
+
185
+ def test_minGpu_describesAMaximumCubeAccepts(monkeypatch: pytest.MonkeyPatch) -> None:
186
+ monkeypatch.setattr(chris_registration, "_memory", [])
187
+ plugin_build(spec_make(minGpu=1), singleton=True)
188
+ details = chris_registration.get_registered()
189
+ assert (details.min_gpu_limit, details.max_gpu_limit) == (1, 1)
190
+ monkeypatch.setattr(chris_registration, "_memory", [])
191
+ plugin_build(spec_make(minGpu=1, maxGpu=2), singleton=True)
192
+ assert chris_registration.get_registered().max_gpu_limit == 2
193
+ monkeypatch.setattr(chris_registration, "_memory", [])
194
+ plugin_build(spec_make(), singleton=True)
195
+ details = chris_registration.get_registered()
196
+ assert (details.min_gpu_limit, details.max_gpu_limit) == (0, 0)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes