gpustack-runtime 0.1.41__py3-none-any.whl → 0.1.41.post2__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.
- gpustack_runtime/_version.py +2 -2
- gpustack_runtime/_version_appendix.py +1 -1
- gpustack_runtime/deployer/cdi/__init__.py +1 -0
- gpustack_runtime/deployer/cdi/__utils__.py +2 -0
- gpustack_runtime/deployer/k8s/deviceplugin/__init__.py +88 -2
- gpustack_runtime/deployer/k8s/deviceplugin/__types__.py +1 -1
- gpustack_runtime/deployer/k8s/deviceplugin/plugin.py +12 -16
- gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api_pb2.py +1115 -72
- gpustack_runtime/deployer/kuberentes.py +20 -7
- gpustack_runtime/envs.py +11 -9
- {gpustack_runtime-0.1.41.dist-info → gpustack_runtime-0.1.41.post2.dist-info}/METADATA +3 -3
- {gpustack_runtime-0.1.41.dist-info → gpustack_runtime-0.1.41.post2.dist-info}/RECORD +15 -15
- {gpustack_runtime-0.1.41.dist-info → gpustack_runtime-0.1.41.post2.dist-info}/WHEEL +0 -0
- {gpustack_runtime-0.1.41.dist-info → gpustack_runtime-0.1.41.post2.dist-info}/entry_points.txt +0 -0
- {gpustack_runtime-0.1.41.dist-info → gpustack_runtime-0.1.41.post2.dist-info}/licenses/LICENSE +0 -0
|
@@ -7,9 +7,9 @@ import operator
|
|
|
7
7
|
import os
|
|
8
8
|
from dataclasses import dataclass, field
|
|
9
9
|
from enum import Enum
|
|
10
|
-
from functools import reduce
|
|
10
|
+
from functools import lru_cache, reduce
|
|
11
11
|
from pathlib import Path
|
|
12
|
-
from typing import TYPE_CHECKING
|
|
12
|
+
from typing import TYPE_CHECKING, Literal
|
|
13
13
|
|
|
14
14
|
import kubernetes
|
|
15
15
|
import kubernetes.stream.ws_client
|
|
@@ -43,7 +43,7 @@ from .__utils__ import (
|
|
|
43
43
|
sensitive_env_var,
|
|
44
44
|
validate_rfc1123_domain_name,
|
|
45
45
|
)
|
|
46
|
-
from .k8s.deviceplugin import cdi_kind_to_kdp_resource
|
|
46
|
+
from .k8s.deviceplugin import cdi_kind_to_kdp_resource, is_kubelet_socket_accessible
|
|
47
47
|
|
|
48
48
|
if TYPE_CHECKING:
|
|
49
49
|
from collections.abc import Callable, Generator
|
|
@@ -381,6 +381,22 @@ class KubernetesDeployer(EndoscopicDeployer):
|
|
|
381
381
|
|
|
382
382
|
return wrapper
|
|
383
383
|
|
|
384
|
+
@staticmethod
|
|
385
|
+
@lru_cache
|
|
386
|
+
def _get_resource_injection_policy() -> Literal["env", "kdp"]:
|
|
387
|
+
"""
|
|
388
|
+
Get the resource injection policy (in lowercase) for the deployer.
|
|
389
|
+
|
|
390
|
+
Returns:
|
|
391
|
+
The resource injection policy.
|
|
392
|
+
|
|
393
|
+
"""
|
|
394
|
+
policy = envs.GPUSTACK_RUNTIME_KUBERNETES_RESOURCE_INJECTION_POLICY.lower()
|
|
395
|
+
if policy != "auto":
|
|
396
|
+
return policy
|
|
397
|
+
|
|
398
|
+
return "kdp" if is_kubelet_socket_accessible() else "env"
|
|
399
|
+
|
|
384
400
|
def _create_ephemeral_configmaps(
|
|
385
401
|
self,
|
|
386
402
|
workload: KubernetesWorkloadPlan,
|
|
@@ -992,10 +1008,7 @@ class KubernetesDeployer(EndoscopicDeployer):
|
|
|
992
1008
|
|
|
993
1009
|
# Parameterize resources
|
|
994
1010
|
if c.resources:
|
|
995
|
-
kdp = (
|
|
996
|
-
envs.GPUSTACK_RUNTIME_KUBERNETES_RESOURCE_INJECTION_POLICY.lower()
|
|
997
|
-
== "kdp"
|
|
998
|
-
)
|
|
1011
|
+
kdp = self._get_resource_injection_policy() == "kdp"
|
|
999
1012
|
|
|
1000
1013
|
resources: dict[str, str] = {}
|
|
1001
1014
|
r_k_runtime_env = workload.resource_key_runtime_env_mapping or {}
|
gpustack_runtime/envs.py
CHANGED
|
@@ -280,7 +280,8 @@ if TYPE_CHECKING:
|
|
|
280
280
|
"""
|
|
281
281
|
GPUSTACK_RUNTIME_KUBERNETES_RESOURCE_INJECTION_POLICY: str | None = None
|
|
282
282
|
"""
|
|
283
|
-
Resource injection policy for the Kubernetes deployer (e.g., Env, KDP).
|
|
283
|
+
Resource injection policy for the Kubernetes deployer (e.g., Auto, Env, KDP).
|
|
284
|
+
`Auto`: Automatically choose the resource injection policy based on the environment.
|
|
284
285
|
`Env`: Injects resources using standard environment variable, depends on underlying Container Toolkit, based on `GPUSTACK_RUNTIME_DEPLOY_RESOURCE_KEY_MAP_RUNTIME_VISIBLE_DEVICES`.
|
|
285
286
|
`KDP`: Injects resources using Kubernetes Device Plugin, based on `GPUSTACK_RUNTIME_DEPLOY_RESOURCE_KEY_MAP_CDI`.
|
|
286
287
|
"""
|
|
@@ -292,8 +293,9 @@ if TYPE_CHECKING:
|
|
|
292
293
|
GPUSTACK_RUNTIME_KUBERNETES_KDP_DEVICE_ALLOCATION_POLICY: str | None = None
|
|
293
294
|
"""
|
|
294
295
|
Device allocation policy for the Kubernetes Device Plugin (e.g., CDI, Env, Opaque).
|
|
295
|
-
`
|
|
296
|
+
`Auto`: Automatically choose the device allocation policy based on the environment.
|
|
296
297
|
`Env`: Allocates devices using runtime-visible environment variables; requires Container Toolkit support.
|
|
298
|
+
`CDI`: Allocates devices using generated CDI specifications, making it easy to debug and troubleshoot; requires `GPUSTACK_RUNTIME_DEPLOY_CDI_SPECS_DIRECTORY` to exist.
|
|
297
299
|
`Opaque`: Uses internal logic for allocation, which is convenient for deployment but difficult to troubleshoot.
|
|
298
300
|
"""
|
|
299
301
|
GPUSTACK_RUNTIME_KUBERNETES_KDP_CDI_SPECS_GENERATE: bool = True
|
|
@@ -685,8 +687,8 @@ variables: dict[str, Callable[[], Any]] = {
|
|
|
685
687
|
getenv(
|
|
686
688
|
"GPUSTACK_RUNTIME_KUBERNETES_RESOURCE_INJECTION_POLICY",
|
|
687
689
|
),
|
|
688
|
-
options=["Env", "KDP"],
|
|
689
|
-
default="
|
|
690
|
+
options=["Auto", "Env", "KDP"],
|
|
691
|
+
default="Auto",
|
|
690
692
|
),
|
|
691
693
|
"GPUSTACK_RUNTIME_KUBERNETES_KDP_PER_DEVICE_MAX_ALLOCATIONS": lambda: to_int(
|
|
692
694
|
getenv(
|
|
@@ -698,12 +700,12 @@ variables: dict[str, Callable[[], Any]] = {
|
|
|
698
700
|
getenv(
|
|
699
701
|
"GPUSTACK_RUNTIME_KUBERNETES_KDP_DEVICE_ALLOCATION_POLICY",
|
|
700
702
|
),
|
|
701
|
-
options=["
|
|
702
|
-
default="
|
|
703
|
+
options=["Auto", "Env", "CDI", "Opaque"],
|
|
704
|
+
default="Auto",
|
|
703
705
|
),
|
|
704
706
|
"GPUSTACK_RUNTIME_KUBERNETES_KDP_CDI_SPECS_GENERATE": lambda: ternary(
|
|
705
707
|
lambda: (
|
|
706
|
-
getenv("GPUSTACK_RUNTIME_KUBERNETES_RESOURCE_INJECTION_POLICY", "
|
|
708
|
+
getenv("GPUSTACK_RUNTIME_KUBERNETES_RESOURCE_INJECTION_POLICY", "Auto")
|
|
707
709
|
== "Env"
|
|
708
710
|
),
|
|
709
711
|
lambda: False,
|
|
@@ -711,9 +713,9 @@ variables: dict[str, Callable[[], Any]] = {
|
|
|
711
713
|
lambda: (
|
|
712
714
|
getenv(
|
|
713
715
|
"GPUSTACK_RUNTIME_KUBERNETES_KDP_DEVICE_ALLOCATION_POLICY",
|
|
714
|
-
"
|
|
716
|
+
"Auto",
|
|
715
717
|
)
|
|
716
|
-
|
|
718
|
+
not in ["Auto", "CDI"]
|
|
717
719
|
),
|
|
718
720
|
lambda: False,
|
|
719
721
|
lambda: to_bool(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gpustack-runtime
|
|
3
|
-
Version: 0.1.41
|
|
3
|
+
Version: 0.1.41.post2
|
|
4
4
|
Summary: GPUStack Runtime is library for detecting GPU resources and launching GPU workloads.
|
|
5
5
|
Project-URL: Homepage, https://github.com/gpustack/runtime
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/gpustack/gpustack/issues
|
|
@@ -23,10 +23,10 @@ Requires-Dist: kubernetes>=33.1.0
|
|
|
23
23
|
Requires-Dist: mthreads-ml-py>=2.2.10
|
|
24
24
|
Requires-Dist: nvidia-ml-py>=13.580.65
|
|
25
25
|
Requires-Dist: podman==5.6.0
|
|
26
|
-
Requires-Dist: protobuf
|
|
26
|
+
Requires-Dist: protobuf<=3.19.6
|
|
27
27
|
Requires-Dist: pyyaml
|
|
28
28
|
Requires-Dist: tqdm
|
|
29
|
-
Requires-Dist: types-protobuf
|
|
29
|
+
Requires-Dist: types-protobuf<=5.28.3.20241203
|
|
30
30
|
Description-Content-Type: text/markdown
|
|
31
31
|
|
|
32
32
|
# GPUStack Runtime
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
gpustack_runtime/__init__.py,sha256=Xw_PVWneitx-8QmW6sJQeymj6zVbEgEndGhIB_km6TI,186
|
|
2
2
|
gpustack_runtime/__main__.py,sha256=O9yJKcN7vg0Ppgc13qesxHwST2wkH3ccOkTQXPWHnNA,3939
|
|
3
|
-
gpustack_runtime/_version.py,sha256=
|
|
3
|
+
gpustack_runtime/_version.py,sha256=fURzjTdczs5t1qsDdLl8wAzcF1VVhLtnm_S0ghrUvIE,792
|
|
4
4
|
gpustack_runtime/_version.pyi,sha256=A42NoSgcqEXVy2OeNm4LXC9CbyonbooYrSUBlPm2lGY,156
|
|
5
|
-
gpustack_runtime/envs.py,sha256=
|
|
5
|
+
gpustack_runtime/envs.py,sha256=Q8vK42OpkY4T72zN6pOz_eCS_hnQElhAmxZ1wdks0xQ,38794
|
|
6
6
|
gpustack_runtime/logging.py,sha256=wMPriPpOuVsuClsjMh0qwEPQKyJiJa89ggdDjqkk7i0,6934
|
|
7
7
|
gpustack_runtime/cmds/__init__.py,sha256=-_X2O2lBn6KcdLGUzhL3lEjQC4_cwA36fvWDnFAgtVM,1382
|
|
8
8
|
gpustack_runtime/cmds/__types__.py,sha256=TBnUWUqzTkDtJnsMv363kdw-H8fOf-XQYbOvrmQif-M,815
|
|
@@ -14,23 +14,23 @@ gpustack_runtime/deployer/__patches__.py,sha256=cTBge8BT6IsY5MzETKY3kN28k3igYfNj
|
|
|
14
14
|
gpustack_runtime/deployer/__types__.py,sha256=PgIWogHOvHKsHoeBjmKFEEM3JrKck89Mmnwlfx01BbE,72248
|
|
15
15
|
gpustack_runtime/deployer/__utils__.py,sha256=paQu2M1UeoSfQPsiskmAqJSiln-8qwibTssEoWFMLec,21109
|
|
16
16
|
gpustack_runtime/deployer/docker.py,sha256=bOaXbTnaalbO42FlyWR1Ha26Y30LGWPzWKPV5Q-Nk7g,85039
|
|
17
|
-
gpustack_runtime/deployer/kuberentes.py,sha256=
|
|
17
|
+
gpustack_runtime/deployer/kuberentes.py,sha256=VkaAvuQJ5rRiNVD6OfM2pE3rmyT_a6oEvp-G8gW8Ojo,89816
|
|
18
18
|
gpustack_runtime/deployer/podman.py,sha256=_qdbsTezacRmiXa3n04OUPUsgVy1pSFgJSKxous4s14,82156
|
|
19
|
-
gpustack_runtime/deployer/cdi/__init__.py,sha256=
|
|
19
|
+
gpustack_runtime/deployer/cdi/__init__.py,sha256=2wHrxkud3GJokE3ytNc3jvjddemXkNuuz_oIKzxD3-I,4000
|
|
20
20
|
gpustack_runtime/deployer/cdi/__types__.py,sha256=04DKvcogk7OoHS7TU2Bmht3VVMu7iOEBWTEOvxpHt4w,18399
|
|
21
|
-
gpustack_runtime/deployer/cdi/__utils__.py,sha256=
|
|
21
|
+
gpustack_runtime/deployer/cdi/__utils__.py,sha256=mvdOqkbhaSkphl0K-VpNwtFviAkttS9UrmKEA285kRw,3908
|
|
22
22
|
gpustack_runtime/deployer/cdi/amd.py,sha256=-eq_SOlC56VX2QscZXvnoeffWSRindhr8zFZmaIcKrE,4082
|
|
23
23
|
gpustack_runtime/deployer/cdi/ascend.py,sha256=lDs75a9--c0lM34xfJqu-_QbfWNFrf4zE-GXPKReBe4,4538
|
|
24
24
|
gpustack_runtime/deployer/cdi/hygon.py,sha256=h6-vQfv03sgxYjMJAf_JOMq9cHFPaNjK1YbUYIiSXck,4117
|
|
25
25
|
gpustack_runtime/deployer/cdi/iluvatar.py,sha256=6nNECZpU5IPP6-5l-O1rzU-ib-WcuwKvDg7ZV__1NE4,3650
|
|
26
26
|
gpustack_runtime/deployer/cdi/metax.py,sha256=tmJBvr-n9pERAp-dXsa54qv6xmxt0rJoJwY36TFdoWk,4143
|
|
27
27
|
gpustack_runtime/deployer/cdi/thead.py,sha256=SvIDKNYZx7FwMPTTxyJ2RRjlr9LXLN8BUYCUhidmiQk,3671
|
|
28
|
-
gpustack_runtime/deployer/k8s/deviceplugin/__init__.py,sha256=
|
|
29
|
-
gpustack_runtime/deployer/k8s/deviceplugin/__types__.py,sha256=
|
|
30
|
-
gpustack_runtime/deployer/k8s/deviceplugin/plugin.py,sha256=
|
|
28
|
+
gpustack_runtime/deployer/k8s/deviceplugin/__init__.py,sha256=KoFztB0MmwO-lHFgEa0wLRsQyG2BN8i5w3mzo43GkbE,10498
|
|
29
|
+
gpustack_runtime/deployer/k8s/deviceplugin/__types__.py,sha256=LCkgPDZ64Mra7bo5jmtsAO2Ypbc4qK99lMl6R_nQhnY,3043
|
|
30
|
+
gpustack_runtime/deployer/k8s/deviceplugin/plugin.py,sha256=ipZ_V6pgJ2pzyEYUgAizZ7_W3a4noKEdTiZ9GAeuiRY,17728
|
|
31
31
|
gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/__init__.py,sha256=3rOYmgDIIJ4idEtwgnumGStH7PaK-J7EYrOnLa9A-8o,118
|
|
32
32
|
gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api.proto,sha256=rmB8RDe4LN5FCVkQ608uS-pl32mk5tt6iGe-g2lKtPs,7919
|
|
33
|
-
gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api_pb2.py,sha256=
|
|
33
|
+
gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api_pb2.py,sha256=dNkzjTE-2y25q8NF0QRznNJ5r1-5ZxxJS598MHbjx98,45998
|
|
34
34
|
gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api_pb2.pyi,sha256=lq1dbSgBYqJ7zyGfoKKHCyfr6R5vcCGzJxteeyQpbuI,8232
|
|
35
35
|
gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/api_pb2_grpc.py,sha256=GM6EyCEFeyOjL0XOCisbcHurRoLKqKDUI5obsUyTxpE,17446
|
|
36
36
|
gpustack_runtime/deployer/k8s/types/kubelet/deviceplugin/v1beta1/constants.py,sha256=tpNk3e_cvY67C9RwVsdTNl75YuNXBgsn53fSJIzeTR4,828
|
|
@@ -59,9 +59,9 @@ gpustack_runtime/detector/pyixml/__init__.py,sha256=6ss_Dyl8lIT4WrKpfwmQqzBmg4Bx
|
|
|
59
59
|
gpustack_runtime/detector/pymxsml/__init__.py,sha256=YxfNHq7TWd7CpNroP45BGXhcWNpY_sXgVzNGtx68DII,45409
|
|
60
60
|
gpustack_runtime/detector/pyrocmcore/__init__.py,sha256=rgwIdPS-7GG7_5luRMR1XG9QyNM3lJh5ryD7kfZqpWg,2523
|
|
61
61
|
gpustack_runtime/detector/pyrocmsmi/__init__.py,sha256=ACwRtJWVIuJ4NTcBJxk0zrVb_qtDOMkApMdbJoag5g0,11906
|
|
62
|
-
gpustack_runtime/_version_appendix.py,sha256=
|
|
63
|
-
gpustack_runtime-0.1.41.dist-info/METADATA,sha256=
|
|
64
|
-
gpustack_runtime-0.1.41.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
65
|
-
gpustack_runtime-0.1.41.dist-info/entry_points.txt,sha256=bBO_61GxP6dIT74uZwbSDgW5Vt2pTePUS3CgjUJkUgg,68
|
|
66
|
-
gpustack_runtime-0.1.41.dist-info/licenses/LICENSE,sha256=OiPibowBvB-NHV3TP_NOj18XNBlXcshXZFMpa3uvKVE,10362
|
|
67
|
-
gpustack_runtime-0.1.41.dist-info/RECORD,,
|
|
62
|
+
gpustack_runtime/_version_appendix.py,sha256=VLCosBR_TL4DtCZkpcNTzR57fiBiNckG8dZUua523Ok,23
|
|
63
|
+
gpustack_runtime-0.1.41.post2.dist-info/METADATA,sha256=KgdFo9ZEq09i9TQWXLYgfmd7mbvAUxY5SYVocoAOJSM,2364
|
|
64
|
+
gpustack_runtime-0.1.41.post2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
65
|
+
gpustack_runtime-0.1.41.post2.dist-info/entry_points.txt,sha256=bBO_61GxP6dIT74uZwbSDgW5Vt2pTePUS3CgjUJkUgg,68
|
|
66
|
+
gpustack_runtime-0.1.41.post2.dist-info/licenses/LICENSE,sha256=OiPibowBvB-NHV3TP_NOj18XNBlXcshXZFMpa3uvKVE,10362
|
|
67
|
+
gpustack_runtime-0.1.41.post2.dist-info/RECORD,,
|
|
File without changes
|
{gpustack_runtime-0.1.41.dist-info → gpustack_runtime-0.1.41.post2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{gpustack_runtime-0.1.41.dist-info → gpustack_runtime-0.1.41.post2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|