xmanager-slurm 0.3.0__py3-none-any.whl

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.

Potentially problematic release.


This version of xmanager-slurm might be problematic. Click here for more details.

Files changed (38) hide show
  1. xm_slurm/__init__.py +44 -0
  2. xm_slurm/api.py +261 -0
  3. xm_slurm/batching.py +139 -0
  4. xm_slurm/config.py +162 -0
  5. xm_slurm/console.py +3 -0
  6. xm_slurm/contrib/clusters/__init__.py +52 -0
  7. xm_slurm/contrib/clusters/drac.py +169 -0
  8. xm_slurm/executables.py +201 -0
  9. xm_slurm/execution.py +491 -0
  10. xm_slurm/executors.py +127 -0
  11. xm_slurm/experiment.py +737 -0
  12. xm_slurm/job_blocks.py +14 -0
  13. xm_slurm/packageables.py +292 -0
  14. xm_slurm/packaging/__init__.py +8 -0
  15. xm_slurm/packaging/docker/__init__.py +75 -0
  16. xm_slurm/packaging/docker/abc.py +112 -0
  17. xm_slurm/packaging/docker/cloud.py +503 -0
  18. xm_slurm/packaging/docker/local.py +206 -0
  19. xm_slurm/packaging/registry.py +45 -0
  20. xm_slurm/packaging/router.py +52 -0
  21. xm_slurm/packaging/utils.py +202 -0
  22. xm_slurm/resources.py +150 -0
  23. xm_slurm/status.py +188 -0
  24. xm_slurm/templates/docker/docker-bake.hcl.j2 +47 -0
  25. xm_slurm/templates/docker/mamba.Dockerfile +27 -0
  26. xm_slurm/templates/docker/pdm.Dockerfile +31 -0
  27. xm_slurm/templates/docker/python.Dockerfile +24 -0
  28. xm_slurm/templates/slurm/fragments/monitor.bash.j2 +32 -0
  29. xm_slurm/templates/slurm/fragments/proxy.bash.j2 +31 -0
  30. xm_slurm/templates/slurm/job-array.bash.j2 +29 -0
  31. xm_slurm/templates/slurm/job-group.bash.j2 +41 -0
  32. xm_slurm/templates/slurm/job.bash.j2 +78 -0
  33. xm_slurm/templates/slurm/runtimes/apptainer.bash.j2 +103 -0
  34. xm_slurm/templates/slurm/runtimes/podman.bash.j2 +56 -0
  35. xm_slurm/utils.py +69 -0
  36. xmanager_slurm-0.3.0.dist-info/METADATA +25 -0
  37. xmanager_slurm-0.3.0.dist-info/RECORD +38 -0
  38. xmanager_slurm-0.3.0.dist-info/WHEEL +4 -0
xm_slurm/utils.py ADDED
@@ -0,0 +1,69 @@
1
+ import functools
2
+ import os
3
+ import pathlib
4
+ import sys
5
+ from typing import Callable, Hashable, Iterable, MutableSet, TypeVar
6
+
7
+ T = TypeVar("T")
8
+
9
+
10
+ class UserSet(Hashable, MutableSet[T]):
11
+ __hash__ = MutableSet._hash
12
+
13
+ def __init__(
14
+ self,
15
+ iterable: Iterable[T] = (),
16
+ /,
17
+ on_add: Callable[[T], None] = lambda x: None,
18
+ on_remove: Callable[[T], None] = lambda x: None,
19
+ on_discard: Callable[[T], None] = lambda x: None,
20
+ ):
21
+ self.data = set(iterable)
22
+ self._on_add = on_add
23
+ self._on_remove = on_remove
24
+ self._on_discard = on_discard
25
+
26
+ def __contains__(self, value):
27
+ return value in self.data
28
+
29
+ def __iter__(self):
30
+ return iter(self.data)
31
+
32
+ def __len__(self):
33
+ return len(self.data)
34
+
35
+ def __repr__(self):
36
+ return repr(self.data)
37
+
38
+ def add(self, item: T):
39
+ self.data.add(item)
40
+ self._on_add(item)
41
+
42
+ def remove(self, item: T):
43
+ self.data.remove(item)
44
+ self._on_remove(item)
45
+
46
+ def discard(self, item: T):
47
+ self.data.discard(item)
48
+ self._on_discard(item)
49
+
50
+
51
+ @functools.cache
52
+ def find_project_root() -> pathlib.Path:
53
+ launch_script_path: pathlib.Path | None = None
54
+ launch_script_path = pathlib.Path(sys.argv[0])
55
+
56
+ if sys.argv[0].endswith(".py"):
57
+ launch_script_path = pathlib.Path(sys.argv[0]).resolve()
58
+ else:
59
+ main_file_path = getattr(sys.modules["__main__"], "__file__", None)
60
+ if main_file_path and os.access(main_file_path, os.R_OK):
61
+ launch_script_path = pathlib.Path(main_file_path).resolve()
62
+
63
+ pdir = launch_script_path.parent if launch_script_path else pathlib.Path.cwd().resolve()
64
+ while pdir != pdir.parent:
65
+ if (pdir / "pyproject.toml").exists():
66
+ return pdir
67
+ pdir = pdir.parent
68
+
69
+ raise RuntimeError(f"Could not find project root from {sys.argv[0]}. Please specify `context`.")
@@ -0,0 +1,25 @@
1
+ Metadata-Version: 2.1
2
+ Name: xmanager-slurm
3
+ Version: 0.3.0
4
+ Summary: Slurm backend for XManager.
5
+ Author-Email: Jesse Farebrother <jfarebro@cs.mcgill.ca>
6
+ License: MIT
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: xmanager>=0.4.0
9
+ Requires-Dist: asyncssh>=2.13.2
10
+ Requires-Dist: humanize>=4.8.0
11
+ Requires-Dist: jinja2>=3.1.2
12
+ Requires-Dist: toml>=0.10.2
13
+ Requires-Dist: rich>=13.5.2
14
+ Requires-Dist: immutabledict>=3.0.0
15
+ Requires-Dist: backoff>=2.2.1
16
+ Requires-Dist: pathspec>=0.11.2; extra == "gcp"
17
+ Requires-Dist: google-cloud-storage>=2.11.0; extra == "gcp"
18
+ Requires-Dist: google-cloud-build>=3.20.0; extra == "gcp"
19
+ Requires-Dist: google-cloud-logging>=3.8.0; extra == "gcp"
20
+ Requires-Dist: google-cloud-iam>=2.12.2; extra == "gcp"
21
+ Requires-Dist: google-cloud-kms>=2.19.2; extra == "gcp"
22
+ Requires-Dist: google-crc32c>=1.5.0; extra == "gcp"
23
+ Requires-Dist: pytest>=7.4.3; extra == "test"
24
+ Provides-Extra: gcp
25
+ Provides-Extra: test
@@ -0,0 +1,38 @@
1
+ xm_slurm/__init__.py,sha256=J5FkaAXbcT7yWmcNgBq3mDLOmnNZW7c4WekSt7JVoFc,1019
2
+ xm_slurm/api.py,sha256=LhAnNfP_M62FEbTSa-NgToxi0OA8kCrUx2czbxfpOjw,9533
3
+ xm_slurm/batching.py,sha256=mGVvccehsC4dfjtg7QqrtxuoxYI_Fs8o1GLJIGVyvyo,4379
4
+ xm_slurm/config.py,sha256=St2bdp2m2pajGxivmsRkmZrKd-inBKF7Hn6oezTT9zM,4955
5
+ xm_slurm/console.py,sha256=UpMqeJ0C8i0pkue1AHnnyyX0bFJ9zZeJ7HBR6yhuA8A,54
6
+ xm_slurm/contrib/clusters/__init__.py,sha256=BM9W2iJE3616uwAUdj1uqcXF70zunXlxWHEXgLdH2xs,1600
7
+ xm_slurm/contrib/clusters/drac.py,sha256=Tl4Cv0DOHssJcnTU5c60w0Ye3dwlDZE4AkPtmew6-lQ,5201
8
+ xm_slurm/executables.py,sha256=4SVn6obIvOKh54RXYccixUx993Xma0rLGanD3TfXNS4,5762
9
+ xm_slurm/execution.py,sha256=EDckbWYtBoMAc0yWU-BitFWGPOkA-AxoQRFv7XdUNcA,17998
10
+ xm_slurm/executors.py,sha256=vilogTjlxHLfZDms4aYOZWUW8w-2IdxU7xh-9vcW1Y0,4723
11
+ xm_slurm/experiment.py,sha256=y5K-kZgavRk022IGXw5bg7beX4cnU1JtUOeP9824sRA,25578
12
+ xm_slurm/job_blocks.py,sha256=1H1eZ5gbEGEoDYcoSh8S_gvp04MLXP7G128crDJlMYo,482
13
+ xm_slurm/packageables.py,sha256=nzmkREacDPJXmo6D1mk4bKjUrLTjHj3rue-PoO_EATk,11216
14
+ xm_slurm/packaging/__init__.py,sha256=dh307yLpUT9KN7rJ1e9fYC6hegGKfZcGboUq9nGpDVQ,233
15
+ xm_slurm/packaging/docker/__init__.py,sha256=SQxaDtomYc4NwZ5lSoCiMoy2S2lRmc0sgwVMbENIatU,2474
16
+ xm_slurm/packaging/docker/abc.py,sha256=f8XvUA_FusIpXI45PR5isA2msxM003ycW5mWbAyiKfk,3830
17
+ xm_slurm/packaging/docker/cloud.py,sha256=8V3Hg_v_TLe6WoJkk3l6S-m7OgK2TNxwfK2glLSFN3o,21300
18
+ xm_slurm/packaging/docker/local.py,sha256=-_elHmU-v0R3XucNMpYF98HCQcMV0x_RTvkt1jLnes4,8008
19
+ xm_slurm/packaging/registry.py,sha256=GrdmQg9MgSo38OiqOzMKWSkQyBuyryOfc3zcdgZ4CUE,1148
20
+ xm_slurm/packaging/router.py,sha256=6qjtsy4BoYgSaQzC_pQSHVHeWcphG_xWVsWgW6ALC7U,2033
21
+ xm_slurm/packaging/utils.py,sha256=dCWAuUXT5COXGe1BQEW8luo5patxTeLSAGOWPR63iY8,6219
22
+ xm_slurm/resources.py,sha256=FqAULBhchu6z66On3SRDOJvXfs0sLGfBvcMGUUB3jxU,4835
23
+ xm_slurm/status.py,sha256=4BUBm-qwVWH_RJGzRxO8Eom5d92_cp8jydQVwqH8v6U,6653
24
+ xm_slurm/templates/docker/docker-bake.hcl.j2,sha256=Ur9t9Yk_LfLPLvJvur47ZKFZmY07H-pJ76edQzAgYfU,1313
25
+ xm_slurm/templates/docker/mamba.Dockerfile,sha256=vsOYkm-T33C2RanwbdjJIUjhPJ_H1NDBeEACguQJZ8c,716
26
+ xm_slurm/templates/docker/pdm.Dockerfile,sha256=Yg5-lOXkNVJr0OER_yOnRvn9NlFLnt3RfdYfq4f0ilg,748
27
+ xm_slurm/templates/docker/python.Dockerfile,sha256=O6lHesmsLz7cX-efVQpsafEVYmbHPyV73xA9WbBKGKg,738
28
+ xm_slurm/templates/slurm/fragments/monitor.bash.j2,sha256=CxtbxOJzd0Un-ApDO6T8JHuKlSv6uwwBFMJPeGjCKnk,1071
29
+ xm_slurm/templates/slurm/fragments/proxy.bash.j2,sha256=VJLglZo-Nvx9R-qe3rHTxr07CylTQ6Z9NwBzvIpAZrA,814
30
+ xm_slurm/templates/slurm/job-array.bash.j2,sha256=d4twfV1PATGQwTIleFBUIGmMAIHH-F7RjBsdfaAIQko,599
31
+ xm_slurm/templates/slurm/job-group.bash.j2,sha256=UkjfBE7jg9mepcUWaHZEAjkiXsIM1j_sLxLzxkteD-Y,1120
32
+ xm_slurm/templates/slurm/job.bash.j2,sha256=EUeq3P2xqTIqlHi2SVhFBT7NL4lUj8okYUa3GnlaIIc,1852
33
+ xm_slurm/templates/slurm/runtimes/apptainer.bash.j2,sha256=Z8Mc4wbmOJW_n9V0hcKsPNEnveZFqsASg8Z3dICaETk,3241
34
+ xm_slurm/templates/slurm/runtimes/podman.bash.j2,sha256=xKXYFvQvazMx0PgvmlRXR6eecoiBUl8y52dIzQtWkBE,1469
35
+ xm_slurm/utils.py,sha256=PNd0vTn33UKm5LpC41TdO9QIFe21V5A0RbYEhQIMjrA,1930
36
+ xmanager_slurm-0.3.0.dist-info/METADATA,sha256=Cjiev-9s_DlKicsDWSgja-m3fYRcnG8UOEXaWTdxyI0,909
37
+ xmanager_slurm-0.3.0.dist-info/WHEEL,sha256=vnE8JVcI2Wz7GRKorsPArnBdnW2SWKWGow5gu5tHlRU,90
38
+ xmanager_slurm-0.3.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: pdm-backend (2.3.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any