gpustack-runtime 0.2.7__tar.gz → 0.2.7.post2__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.
Files changed (162) hide show
  1. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/PKG-INFO +3 -4
  2. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/_version.py +2 -2
  3. gpustack_runtime-0.2.7.post2/gpustack_runtime/_version_appendix.py +1 -0
  4. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/__types__.py +33 -23
  5. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/docker.py +26 -44
  6. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/kubernetes.py +9 -11
  7. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/pyproject.toml +3 -5
  8. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_kubernetes_status.py +12 -12
  9. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_visible_devices_ordering.py +114 -3
  10. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_workload_resource_injection_policy.py +2 -2
  11. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_workload_status.py +2 -2
  12. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/uv.lock +17 -154
  13. gpustack_runtime-0.2.7/gpustack_runtime/_version_appendix.py +0 -1
  14. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/.agents/skills/runtime-release/SKILL.md +0 -0
  15. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/.codespelldict +0 -0
  16. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/.codespellrc +0 -0
  17. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/.dockerignore +0 -0
  18. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/.gitattributes +0 -0
  19. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/.gitignore +0 -0
  20. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/.pre-commit-config.yaml +0 -0
  21. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/.python-version +0 -0
  22. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/ADOPTERS.md +0 -0
  23. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/AGENTS.md +0 -0
  24. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/DCO +0 -0
  25. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/LICENSE +0 -0
  26. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/Makefile +0 -0
  27. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/README.md +0 -0
  28. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/deploy/manifests/docker-compose.yaml +0 -0
  29. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/deploy/manifests/kubernetes.yaml +0 -0
  30. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/docs/index.md +0 -0
  31. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/docs/modules/gpustack_runtime.deployer.md +0 -0
  32. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/docs/modules/gpustack_runtime.detector.md +0 -0
  33. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/docs/modules/gpustack_runtime.md +0 -0
  34. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/__init__.py +0 -0
  35. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/__main__.py +0 -0
  36. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/_version.pyi +0 -0
  37. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/cmds/__init__.py +0 -0
  38. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/cmds/__types__.py +0 -0
  39. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/cmds/deployer.py +0 -0
  40. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/cmds/detector.py +0 -0
  41. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/cmds/images.py +0 -0
  42. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/__init__.py +0 -0
  43. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/__patches__.py +0 -0
  44. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/__utils__.py +0 -0
  45. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/cdi/__init__.py +0 -0
  46. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/cdi/__types__.py +0 -0
  47. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/cdi/__utils__.py +0 -0
  48. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/cdi/amd.py +0 -0
  49. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/cdi/ascend.py +0 -0
  50. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/cdi/hygon.py +0 -0
  51. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/cdi/iluvatar.py +0 -0
  52. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/cdi/metax.py +0 -0
  53. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/cdi/thead.py +0 -0
  54. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/k8s/devicemanager/__init__.py +0 -0
  55. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/deployer/podman.py +0 -0
  56. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/__init__.py +0 -0
  57. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/__types__.py +0 -0
  58. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/__utils__.py +0 -0
  59. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/amd.py +0 -0
  60. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/ascend.py +0 -0
  61. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/cambricon.py +0 -0
  62. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/hygon.py +0 -0
  63. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/iluvatar.py +0 -0
  64. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/metax.py +0 -0
  65. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/mthreads.py +0 -0
  66. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/nvidia.py +0 -0
  67. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pyamdgpu/__init__.py +0 -0
  68. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pyamdsmi/__init__.py +0 -0
  69. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pycndev/__init__.py +0 -0
  70. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pydcmi/__init__.py +0 -0
  71. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pydmi/__init__.py +0 -0
  72. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pyhgml/__init__.py +0 -0
  73. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pyhgml/libhgml.so +0 -0
  74. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pyhgml/libuki.so +0 -0
  75. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pyhsa/__init__.py +0 -0
  76. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pyixml/__init__.py +0 -0
  77. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pymtml/__init__.py +0 -0
  78. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pymxsml/__init__.py +0 -0
  79. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pynvml/__init__.py +0 -0
  80. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/pyrocmsmi/__init__.py +0 -0
  81. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/detector/thead.py +0 -0
  82. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/envs.py +0 -0
  83. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/gpustack_runtime/logging.py +0 -0
  84. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/hatch.toml +0 -0
  85. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/mkdocs.yml +0 -0
  86. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/pack/Dockerfile +0 -0
  87. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/pack/Dockerfile.dummy +0 -0
  88. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/pytest.ini +0 -0
  89. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/ruff.toml +0 -0
  90. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/specs/2026-08-14-detector-alignment-and-workload-exit-status.md +0 -0
  91. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/specs/2026-10-30-detector-health-alignment-and-identity-cache.md +0 -0
  92. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/fixtures/__init__.py +0 -0
  93. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/fixtures/test_compare_versions.json +0 -0
  94. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/fixtures/test_correct_runner_image.json +0 -0
  95. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json.json +0 -0
  96. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_multiple_jsons.json +0 -0
  97. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_multiple_yamls.yaml +0 -0
  98. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_single_json.json +0 -0
  99. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/fixtures/test_load_yaml_or_json_single_yaml.yaml +0 -0
  100. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/fixtures/test_nginx_entrypoint.sh +0 -0
  101. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_ascend_ranktable.py +0 -0
  102. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_docker_status.py +0 -0
  103. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_logs_options.py +0 -0
  104. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_podman_status.py +0 -0
  105. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_privileged.py +0 -0
  106. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_resource_injection_policy.py +0 -0
  107. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_runtime_class.py +0 -0
  108. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_termination_grace_period.py +0 -0
  109. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/deployer/test_utils.py +0 -0
  110. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/conftest.py +0 -0
  111. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/fixtures/__init__.py +0 -0
  112. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/README.md +0 -0
  113. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_amd_mi300x.json +0 -0
  114. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_amd_mi308x.json +0 -0
  115. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_amd_rx7800xt.json +0 -0
  116. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_ascend_310p3.json +0 -0
  117. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_ascend_910b2.json +0 -0
  118. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_hygon_k100ai.json +0 -0
  119. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_metax_c500.json +0 -0
  120. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_gb10.json +0 -0
  121. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_h100.json +0 -0
  122. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_h100_mig.json +0 -0
  123. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_h200.json +0 -0
  124. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx4080super.json +0 -0
  125. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx4090_48g.json +0 -0
  126. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx4090d.json +0 -0
  127. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_nvidia_rtx5090d.json +0 -0
  128. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/detect_output_thead_ppu.json +0 -0
  129. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_amd_mi300x.json +0 -0
  130. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_amd_mi308x.json +0 -0
  131. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_amd_rx7800xt.json +0 -0
  132. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_ascend_310p3.json +0 -0
  133. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_ascend_910b2.json +0 -0
  134. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_hygon_k100ai.json +0 -0
  135. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_metax_c500.json +0 -0
  136. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_mthreads_s5000.json +0 -0
  137. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_h100.json +0 -0
  138. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_h100_mig.json +0 -0
  139. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_h200.json +0 -0
  140. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx4080super.json +0 -0
  141. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx4090_48g.json +0 -0
  142. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx4090d.json +0 -0
  143. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_nvidia_rtx5090d.json +0 -0
  144. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/samples/topology_output_thead_ppu.json +0 -0
  145. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_amd.py +0 -0
  146. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_ascend.py +0 -0
  147. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_cambricon.py +0 -0
  148. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_detector_cache.py +0 -0
  149. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_detector_cli.py +0 -0
  150. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_detector_types.py +0 -0
  151. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_detector_utils.py +0 -0
  152. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_hygon.py +0 -0
  153. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_iluvatar.py +0 -0
  154. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_metax.py +0 -0
  155. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_mig_devices.py +0 -0
  156. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_mthreads.py +0 -0
  157. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_nvidia.py +0 -0
  158. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_pycndev.py +0 -0
  159. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_pydmi.py +0 -0
  160. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_samples.py +0 -0
  161. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/tests/gpustack_runtime/detector/test_thead.py +0 -0
  162. {gpustack_runtime-0.2.7 → gpustack_runtime-0.2.7.post2}/uv.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: gpustack-runtime
3
- Version: 0.2.7
3
+ Version: 0.2.7.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
@@ -8,15 +8,14 @@ Author-email: GPUStack Authors <contact@gpustack.ai>
8
8
  License-Expression: Apache-2.0
9
9
  License-File: LICENSE
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.10
12
11
  Classifier: Programming Language :: Python :: 3.11
13
12
  Classifier: Programming Language :: Python :: 3.12
14
13
  Classifier: Programming Language :: Python :: 3.13
15
- Requires-Python: >=3.10
14
+ Requires-Python: >=3.11
16
15
  Requires-Dist: argcomplete>=3.6.3
17
16
  Requires-Dist: cachetools>=5.5.2
18
17
  Requires-Dist: docker>=7.1.0
19
- Requires-Dist: gpustack-runner>=0.1.32.post2
18
+ Requires-Dist: gpustack-runner>=0.1.32.post3
20
19
  Requires-Dist: kubernetes>=33.1.0
21
20
  Requires-Dist: mthreads-ml-py>=2.2.10
22
21
  Requires-Dist: nvidia-ml-py>=13.580.65
@@ -27,8 +27,8 @@ version_tuple: VERSION_TUPLE
27
27
  __commit_id__: COMMIT_ID
28
28
  commit_id: COMMIT_ID
29
29
 
30
- __version__ = version = '0.2.7'
31
- __version_tuple__ = version_tuple = (0, 2, 7)
30
+ __version__ = version = '0.2.7.post2'
31
+ __version_tuple__ = version_tuple = (0, 2, 7, 'post2')
32
32
  try:
33
33
  from ._version_appendix import git_commit
34
34
  __commit_id__ = commit_id = git_commit
@@ -0,0 +1 @@
1
+ git_commit = "42d5150"
@@ -8,6 +8,7 @@ from abc import ABC, abstractmethod
8
8
  from concurrent.futures import ThreadPoolExecutor
9
9
  from dataclasses import dataclass, field
10
10
  from enum import Enum
11
+ from threading import Lock
11
12
  from typing import TYPE_CHECKING, Any
12
13
 
13
14
  from dataclasses_json import dataclass_json
@@ -1492,6 +1493,9 @@ class DevicesMaterial:
1492
1493
  """
1493
1494
 
1494
1495
 
1496
+ UNKNOWN_RUNTIME_ENV = "UNKNOWN_RUNTIME_VISIBLE_DEVICES"
1497
+
1498
+
1495
1499
  class Deployer(ABC):
1496
1500
  """
1497
1501
  Base class for all deployers.
@@ -1549,6 +1553,7 @@ class Deployer(ABC):
1549
1553
 
1550
1554
  def __init__(self, name: str):
1551
1555
  self._name = name
1556
+ self._materials_lock = Lock()
1552
1557
 
1553
1558
  def __enter__(self):
1554
1559
  return self
@@ -1556,15 +1561,30 @@ class Deployer(ABC):
1556
1561
  def __exit__(self, exc_type, exc_value, traceback):
1557
1562
  self.close()
1558
1563
 
1559
- def _prepare(self):
1564
+ def _prepare(self) -> dict[str, DevicesMaterial]:
1560
1565
  """
1561
- Detect devices and prepare materials.
1566
+ Build and cache device materials while the caller holds the cache lock.
1562
1567
  """
1563
- if self._materials is not None:
1564
- return
1568
+ materials = self._detect_materials()
1569
+ if materials:
1570
+ self._materials = materials
1571
+ return materials
1565
1572
 
1566
- self._materials = {}
1573
+ # Keep the generic fallback available without caching an empty detection.
1574
+ ben = "UNKNOWN_BACKEND_VISIBLE_DEVICES"
1575
+ return {
1576
+ UNKNOWN_RUNTIME_ENV: DevicesMaterial(
1577
+ manufacturer=ManufacturerEnum.UNKNOWN,
1578
+ runtime_env=UNKNOWN_RUNTIME_ENV,
1579
+ backend_env=[ben],
1580
+ cdi="unknown.com/gpu",
1581
+ runtime_values={"all": "all"},
1582
+ backend_values={ben: {"all": "all"}},
1583
+ ),
1584
+ }
1567
1585
 
1586
+ def _detect_materials(self) -> dict[str, DevicesMaterial]:
1587
+ materials: dict[str, DevicesMaterial] = {}
1568
1588
  devices = detect_devices(fast=False)
1569
1589
  if self.allowed_mig_devices:
1570
1590
  devices = expand_mig_devices(devices)
@@ -1617,7 +1637,7 @@ class Deployer(ABC):
1617
1637
  dev_numa_affinities[dev_index],
1618
1638
  )
1619
1639
 
1620
- self._materials[ren] = DevicesMaterial(
1640
+ materials[ren] = DevicesMaterial(
1621
1641
  manufacturer=manu,
1622
1642
  runtime_env=ren,
1623
1643
  backend_env=ben_list,
@@ -1638,21 +1658,7 @@ class Deployer(ABC):
1638
1658
  cpus_affinities=dev_cpus_affinities,
1639
1659
  )
1640
1660
 
1641
- if self._materials:
1642
- return
1643
-
1644
- # Fallback to unknown backend
1645
- ren = "UNKNOWN_RUNTIME_VISIBLE_DEVICES"
1646
- ben_list = ["UNKNOWN_BACKEND_VISIBLE_DEVICES"]
1647
- cdi = "unknown.com/gpu"
1648
- self._materials[ren] = DevicesMaterial(
1649
- manufacturer=ManufacturerEnum.UNKNOWN,
1650
- runtime_env=ren,
1651
- backend_env=ben_list,
1652
- cdi=cdi,
1653
- runtime_values={"all": "all"},
1654
- backend_values={ben: {"all": "all"} for ben in ben_list},
1655
- )
1661
+ return materials
1656
1662
 
1657
1663
  def _get_materials(
1658
1664
  self,
@@ -1665,8 +1671,12 @@ class Deployer(ABC):
1665
1671
  to corresponding devices materials.
1666
1672
 
1667
1673
  """
1668
- self._prepare()
1669
- return self._materials
1674
+ if self._materials is not None:
1675
+ return self._materials
1676
+ with self._materials_lock:
1677
+ if self._materials is not None:
1678
+ return self._materials
1679
+ return self._prepare()
1670
1680
 
1671
1681
  def get_manufacturer(
1672
1682
  self,
@@ -29,6 +29,7 @@ from .. import envs
29
29
  from ..logging import debug_log_exception, debug_log_warning
30
30
  from .__types__ import (
31
31
  DEFAULT_TERMINATION_GRACE_PERIOD_SECONDS,
32
+ UNKNOWN_RUNTIME_ENV,
32
33
  Container,
33
34
  ContainerCheck,
34
35
  ContainerEnv,
@@ -1076,53 +1077,34 @@ class DockerDeployer(EndoscopicDeployer):
1076
1077
  manu,
1077
1078
  )
1078
1079
 
1079
- # Request devices.
1080
1080
  if r_v == "all":
1081
- # Configure privileged.
1082
1081
  create_options["privileged"] = True
1083
- # Request all devices.
1084
- for ren in runtime_envs:
1082
+
1083
+ for ren in runtime_envs:
1084
+ if r_v == "all" or privileged:
1085
1085
  r_vs = self.get_runtime_visible_devices(ren, fmt)
1086
- # Request device via CDI.
1087
- if cdi:
1088
- if "device_requests" not in create_options:
1089
- create_options["device_requests"] = []
1090
- create_options["device_requests"].append(
1091
- docker.types.DeviceRequest(
1092
- driver="cdi",
1093
- count=0,
1094
- device_ids=r_vs,
1095
- ),
1096
- )
1097
- continue
1098
- # Request device via visible devices env.
1099
- create_options["environment"][ren] = ",".join(r_vs)
1100
- else:
1101
- # Request specific devices.
1102
- for ren in runtime_envs:
1103
- # Request all devices if privileged,
1104
- # otherwise, normalize requested devices.
1105
- if privileged:
1106
- r_vs = self.get_runtime_visible_devices(ren, fmt)
1107
- else:
1108
- r_vs = self.map_runtime_visible_devices(
1109
- ren,
1110
- resource_values,
1111
- fmt,
1112
- )
1113
- # Request device via CDI.
1114
- if cdi:
1115
- if "device_requests" not in create_options:
1116
- create_options["device_requests"] = []
1117
- create_options["device_requests"].append(
1118
- docker.types.DeviceRequest(
1119
- driver="cdi",
1120
- count=0,
1121
- device_ids=r_vs,
1122
- ),
1123
- )
1124
- continue
1125
- # Request device via visible devices env.
1086
+ else:
1087
+ r_vs = self.map_runtime_visible_devices(
1088
+ ren,
1089
+ resource_values,
1090
+ fmt,
1091
+ )
1092
+ if not r_vs or (ren == UNKNOWN_RUNTIME_ENV and r_v != "all"):
1093
+ msg = (
1094
+ f"Cannot create container {container_name}: "
1095
+ f"no detected devices for {ren} "
1096
+ f"(requested {r_k}={r_v})"
1097
+ )
1098
+ raise OperationError(msg)
1099
+ if cdi:
1100
+ create_options.setdefault("device_requests", []).append(
1101
+ docker.types.DeviceRequest(
1102
+ driver="cdi",
1103
+ count=0,
1104
+ device_ids=r_vs,
1105
+ ),
1106
+ )
1107
+ else:
1126
1108
  create_options["environment"][ren] = ",".join(r_vs)
1127
1109
 
1128
1110
  # If not requesting all devices but privileged,
@@ -9,7 +9,7 @@ import re
9
9
  import time
10
10
  from copy import copy
11
11
  from dataclasses import dataclass, field
12
- from datetime import datetime, timezone
12
+ from datetime import UTC, datetime
13
13
  from decimal import Decimal
14
14
  from enum import Enum
15
15
  from pathlib import Path
@@ -427,7 +427,7 @@ class KubernetesWorkloadStatus(WorkloadStatus):
427
427
  # timestamp at all sorts first, i.e. loses to any that does.
428
428
  k_warnings.sort(
429
429
  key=lambda e: (e.last_timestamp or e.event_time or e.first_timestamp)
430
- or datetime.min.replace(tzinfo=timezone.utc),
430
+ or datetime.min.replace(tzinfo=UTC),
431
431
  )
432
432
 
433
433
  # Among the warnings, the kubelet's image-pull failure is the one being
@@ -1844,24 +1844,22 @@ class KubernetesDeployer(EndoscopicDeployer):
1844
1844
  self._materials_cache: dict[str, dict[str, DevicesMaterial]] = {}
1845
1845
  self._materials_locks = {policy: Lock() for policy in ("env", "kdp")}
1846
1846
 
1847
- def _prepare(self):
1847
+ def _get_materials(self) -> dict[str, DevicesMaterial]:
1848
1848
  """
1849
1849
  Reuse device materials built for the same resolved injection policy.
1850
1850
  """
1851
1851
  if self._materials is not None:
1852
- return
1852
+ return self._materials
1853
1853
  policy = self._resolve_resource_injection_policy()
1854
1854
  with self._materials_locks[policy]:
1855
1855
  if policy not in self._materials_cache:
1856
1856
  self._runtime_uuid_values_allowed = policy != "kdp"
1857
- try:
1858
- super()._prepare()
1859
- except Exception:
1860
- # Incomplete detection must not become a reusable device map.
1861
- self._materials = None
1862
- raise
1863
- self._materials_cache[policy] = self._materials
1857
+ materials = self._prepare()
1858
+ if self._materials is not None:
1859
+ self._materials_cache[policy] = self._materials
1860
+ return materials
1864
1861
  self._materials = self._materials_cache[policy]
1862
+ return self._materials
1865
1863
 
1866
1864
  @property
1867
1865
  def allowed_runtime_uuid_values(self) -> bool:
@@ -6,13 +6,12 @@ build-backend = "hatchling.build"
6
6
  name = "gpustack-runtime"
7
7
  description = "GPUStack Runtime is library for detecting GPU resources and launching GPU workloads."
8
8
  readme = "README.md"
9
- requires-python = ">=3.10"
9
+ requires-python = ">=3.11"
10
10
  authors = [{name = "GPUStack Authors", email = "contact@gpustack.ai"}]
11
11
  license = "Apache-2.0"
12
12
  license-files = ["LICENSE"]
13
13
  classifiers = [
14
14
  "Programming Language :: Python :: 3",
15
- "Programming Language :: Python :: 3.10",
16
15
  "Programming Language :: Python :: 3.11",
17
16
  "Programming Language :: Python :: 3.12",
18
17
  "Programming Language :: Python :: 3.13",
@@ -23,7 +22,7 @@ dependencies = [
23
22
  # NB(thxCode): Pin to this Podman version for a custom patch. See gpustack_runtime/deployer/__patches__.py.
24
23
  "podman==5.6.0",
25
24
  "pyyaml",
26
- "gpustack-runner>=0.1.32.post2",
25
+ "gpustack-runner>=0.1.32.post3",
27
26
  "nvidia-ml-py>=13.580.65",
28
27
  "mthreads-ml-py>=2.2.10",
29
28
  "argcomplete>=3.6.3",
@@ -56,6 +55,5 @@ dev=[
56
55
 
57
56
  [tool.uv]
58
57
  override-dependencies = [
59
- "filelock==3.20.3; python_full_version < '3.11'",
60
- "filelock>=4.2.1; python_full_version >= '3.11'",
58
+ "filelock>=4.2.1",
61
59
  ]
@@ -3,7 +3,7 @@
3
3
  # observable without a live cluster: hand-built kubernetes.client objects plus a
4
4
  # fake CoreV1Api carrying a call log.
5
5
 
6
- from datetime import datetime, timezone
6
+ from datetime import UTC, datetime
7
7
 
8
8
  import kubernetes.client
9
9
  import pytest
@@ -77,7 +77,7 @@ def _pod(
77
77
  name="gpustack-test",
78
78
  namespace="default",
79
79
  uid=uid,
80
- creation_timestamp=datetime(2026, 8, 14, 8, 0, 0, tzinfo=timezone.utc),
80
+ creation_timestamp=datetime(2026, 8, 14, 8, 0, 0, tzinfo=UTC),
81
81
  labels={"app": "test"},
82
82
  annotations=annotations,
83
83
  ),
@@ -135,8 +135,8 @@ def _terminated_status(
135
135
  exit_code=exit_code,
136
136
  reason=reason,
137
137
  message="the process exited",
138
- started_at=datetime(2026, 8, 14, 8, 1, 0, tzinfo=timezone.utc),
139
- finished_at=datetime(2026, 8, 14, 8, 2, 0, tzinfo=timezone.utc),
138
+ started_at=datetime(2026, 8, 14, 8, 1, 0, tzinfo=UTC),
139
+ finished_at=datetime(2026, 8, 14, 8, 2, 0, tzinfo=UTC),
140
140
  ),
141
141
  ),
142
142
  )
@@ -155,15 +155,15 @@ def _restarted_status(
155
155
  restart_count=1,
156
156
  state=kubernetes.client.V1ContainerState(
157
157
  running=kubernetes.client.V1ContainerStateRunning(
158
- started_at=datetime(2026, 8, 14, 8, 3, 0, tzinfo=timezone.utc),
158
+ started_at=datetime(2026, 8, 14, 8, 3, 0, tzinfo=UTC),
159
159
  ),
160
160
  ),
161
161
  last_state=kubernetes.client.V1ContainerState(
162
162
  terminated=kubernetes.client.V1ContainerStateTerminated(
163
163
  exit_code=137,
164
164
  reason="OOMKilled",
165
- started_at=datetime(2026, 8, 14, 8, 1, 0, tzinfo=timezone.utc),
166
- finished_at=datetime(2026, 8, 14, 8, 2, 0, tzinfo=timezone.utc),
165
+ started_at=datetime(2026, 8, 14, 8, 1, 0, tzinfo=UTC),
166
+ finished_at=datetime(2026, 8, 14, 8, 2, 0, tzinfo=UTC),
167
167
  ),
168
168
  ),
169
169
  )
@@ -178,7 +178,7 @@ def _ready_status(name: str = "run-0") -> kubernetes.client.V1ContainerStatus:
178
178
  restart_count=0,
179
179
  state=kubernetes.client.V1ContainerState(
180
180
  running=kubernetes.client.V1ContainerStateRunning(
181
- started_at=datetime(2026, 8, 14, 8, 1, 0, tzinfo=timezone.utc),
181
+ started_at=datetime(2026, 8, 14, 8, 1, 0, tzinfo=UTC),
182
182
  ),
183
183
  ),
184
184
  )
@@ -223,9 +223,9 @@ def test_pod_event_message_takes_the_latest_by_timestamp():
223
223
  stale = _event(
224
224
  message="0/3 nodes are available: insufficient nvidia.com/gpu.",
225
225
  reason="FailedScheduling",
226
- last_timestamp=datetime(2026, 8, 14, 7, 0, 0, tzinfo=timezone.utc),
226
+ last_timestamp=datetime(2026, 8, 14, 7, 0, 0, tzinfo=UTC),
227
227
  )
228
- latest = _event(last_timestamp=datetime(2026, 8, 14, 9, 0, 0, tzinfo=timezone.utc))
228
+ latest = _event(last_timestamp=datetime(2026, 8, 14, 9, 0, 0, tzinfo=UTC))
229
229
  api = _FakeCoreV1Api(events=[latest, stale])
230
230
 
231
231
  status = KubernetesWorkloadStatus(
@@ -244,10 +244,10 @@ def test_pod_event_message_prefers_the_image_pull_failure():
244
244
  later_unrelated = _event(
245
245
  message="Liveness probe failed: connection refused",
246
246
  reason="Unhealthy",
247
- last_timestamp=datetime(2026, 8, 14, 10, 0, 0, tzinfo=timezone.utc),
247
+ last_timestamp=datetime(2026, 8, 14, 10, 0, 0, tzinfo=UTC),
248
248
  )
249
249
  pull_failure = _event(
250
- last_timestamp=datetime(2026, 8, 14, 9, 0, 0, tzinfo=timezone.utc),
250
+ last_timestamp=datetime(2026, 8, 14, 9, 0, 0, tzinfo=UTC),
251
251
  )
252
252
  api = _FakeCoreV1Api(events=[pull_failure, later_unrelated])
253
253
 
@@ -3,6 +3,8 @@
3
3
  # Docker daemon, Podman socket or Kubernetes cluster.
4
4
  # ruff: noqa: SLF001
5
5
 
6
+ from concurrent.futures import ThreadPoolExecutor
7
+ from threading import Event
6
8
  from types import SimpleNamespace
7
9
 
8
10
  import docker.errors
@@ -18,6 +20,7 @@ from gpustack_runtime.deployer.__types__ import (
18
20
  ContainerResources,
19
21
  Deployer,
20
22
  DevicesMaterial,
23
+ OperationError,
21
24
  )
22
25
  from gpustack_runtime.deployer.docker import DockerDeployer, DockerWorkloadPlan
23
26
  from gpustack_runtime.deployer.kubernetes import (
@@ -25,7 +28,7 @@ from gpustack_runtime.deployer.kubernetes import (
25
28
  KubernetesWorkloadPlan,
26
29
  )
27
30
  from gpustack_runtime.deployer.podman import PodmanDeployer, PodmanWorkloadPlan
28
- from gpustack_runtime.detector import ManufacturerEnum
31
+ from gpustack_runtime.detector import Device, ManufacturerEnum
29
32
 
30
33
  _ORDERING_ENV = "CUDA_DEVICE_ORDER"
31
34
 
@@ -62,7 +65,7 @@ _AMD_MATERIALS = {
62
65
  _MIXED_MATERIALS = {**_NVIDIA_MATERIALS, **_AMD_MATERIALS}
63
66
 
64
67
 
65
- def _deployer(cls, materials: dict[str, DevicesMaterial]):
68
+ def _deployer(cls, materials: dict[str, DevicesMaterial] | None):
66
69
  # Bypass the deployer's __init__, which reaches out to a live daemon or
67
70
  # API server, and pin the materials so _prepare() short-circuits instead
68
71
  # of detecting devices.
@@ -106,7 +109,7 @@ class _FakeContainers:
106
109
 
107
110
 
108
111
  def _docker_container_envs(
109
- materials: dict[str, DevicesMaterial],
112
+ materials: dict[str, DevicesMaterial] | None,
110
113
  container: Container,
111
114
  monkeypatch,
112
115
  ) -> list[tuple[str, str]]:
@@ -133,6 +136,114 @@ def _docker_container_envs(
133
136
  return list(created[0]["environment"].items())
134
137
 
135
138
 
139
+ @pytest.mark.parametrize(
140
+ "resource_key, requested",
141
+ [
142
+ ("huawei.com/devices", "2,3"),
143
+ ("huawei.com/devices", "all"),
144
+ ("gpustack.ai/devices", "2,3"),
145
+ ],
146
+ )
147
+ def test_docker_rejects_request_without_device_material(
148
+ monkeypatch,
149
+ resource_key,
150
+ requested,
151
+ ):
152
+ monkeypatch.setattr(
153
+ "gpustack_runtime.deployer.__types__.detect_devices",
154
+ lambda **_: [],
155
+ )
156
+ container = _container({resource_key: requested}, privileged=True)
157
+
158
+ with pytest.raises(OperationError, match=f"requested {resource_key}={requested}"):
159
+ _docker_container_envs(None, container, monkeypatch)
160
+
161
+
162
+ def test_docker_preserves_automap_all_fallback(monkeypatch):
163
+ monkeypatch.setattr(
164
+ "gpustack_runtime.deployer.__types__.detect_devices",
165
+ lambda **_: [],
166
+ )
167
+ container = _container({"gpustack.ai/devices": "all"})
168
+
169
+ assert dict(_docker_container_envs(None, container, monkeypatch)) == {
170
+ "UNKNOWN_RUNTIME_VISIBLE_DEVICES": "all",
171
+ }
172
+
173
+
174
+ def test_docker_retries_device_detection_after_empty_result(monkeypatch):
175
+ devices = iter(
176
+ [
177
+ [],
178
+ [
179
+ Device(
180
+ manufacturer=ManufacturerEnum.ASCEND,
181
+ index=index,
182
+ name="Ascend 910B2",
183
+ uuid=str(index),
184
+ appendix={},
185
+ )
186
+ for index in range(4)
187
+ ],
188
+ ],
189
+ )
190
+ monkeypatch.setattr(
191
+ "gpustack_runtime.deployer.__types__.detect_devices",
192
+ lambda **_: next(devices),
193
+ )
194
+ deployer = _deployer(DockerDeployer, None)
195
+ runtime_env = "ASCEND_VISIBLE_DEVICES"
196
+
197
+ assert deployer.get_runtime_visible_devices(runtime_env) == []
198
+ assert deployer.get_runtime_visible_devices(runtime_env) == ["0", "1", "2", "3"]
199
+ assert deployer.map_backend_visible_devices([runtime_env], ["2", "3"]) == {
200
+ "ASCEND_RT_VISIBLE_DEVICES": "2,3",
201
+ "NPU_VISIBLE_DEVICES": "2,3",
202
+ }
203
+
204
+
205
+ def test_concurrent_device_mapping_waits_for_detection(monkeypatch):
206
+ detection_started = Event()
207
+ finish_detection = Event()
208
+ lookup_started = Event()
209
+ deployer = _deployer(DockerDeployer, None)
210
+ runtime_env = "ASCEND_VISIBLE_DEVICES"
211
+
212
+ def detect(**_):
213
+ assert not detection_started.is_set()
214
+ detection_started.set()
215
+ assert finish_detection.wait(timeout=5)
216
+ return [
217
+ Device(
218
+ manufacturer=ManufacturerEnum.ASCEND,
219
+ index=0,
220
+ name="Ascend 910B2",
221
+ uuid="0",
222
+ appendix={},
223
+ ),
224
+ ]
225
+
226
+ def lookup():
227
+ lookup_started.set()
228
+ return deployer.map_backend_visible_devices([runtime_env], ["0"])
229
+
230
+ monkeypatch.setattr("gpustack_runtime.deployer.__types__.detect_devices", detect)
231
+ with ThreadPoolExecutor(max_workers=2) as executor:
232
+ first = executor.submit(deployer.get_runtime_visible_devices, runtime_env)
233
+ try:
234
+ assert detection_started.wait(timeout=5)
235
+ second = executor.submit(lookup)
236
+ assert lookup_started.wait(timeout=5)
237
+ assert deployer._materials is None
238
+ finally:
239
+ finish_detection.set()
240
+ assert first.result(timeout=5) == ["0"]
241
+ assert second.result(timeout=5) == {
242
+ "ASCEND_RT_VISIBLE_DEVICES": "0",
243
+ "NPU_VISIBLE_DEVICES": "0",
244
+ }
245
+
246
+
136
247
  def _podman_container_envs(
137
248
  materials: dict[str, DevicesMaterial],
138
249
  container: Container,
@@ -5,7 +5,7 @@ from __future__ import annotations as __future_annotations__
5
5
 
6
6
  import json
7
7
  from concurrent.futures import ThreadPoolExecutor
8
- from datetime import datetime, timezone
8
+ from datetime import UTC, datetime
9
9
  from threading import Barrier
10
10
  from types import SimpleNamespace
11
11
  from unittest.mock import MagicMock
@@ -339,7 +339,7 @@ def test_workloads_share_default_node_and_remain_listable(cluster, monkeypatch):
339
339
  select_node.assert_called_once()
340
340
  for pod in cluster.pods.values():
341
341
  assert pod.spec.node_name == "node-a"
342
- pod.metadata.creation_timestamp = datetime(2026, 1, 1, tzinfo=timezone.utc)
342
+ pod.metadata.creation_timestamp = datetime(2026, 1, 1, tzinfo=UTC)
343
343
  pod.status = kubernetes.client.V1PodStatus(phase="Running")
344
344
  cluster.core.list_namespaced_pod.return_value = kubernetes.client.V1PodList(
345
345
  items=list(cluster.pods.values()),
@@ -1,5 +1,5 @@
1
1
  import json
2
- from datetime import datetime, timezone
2
+ from datetime import UTC, datetime
3
3
 
4
4
  import kubernetes.client
5
5
 
@@ -20,7 +20,7 @@ def _pod(annotations=None) -> kubernetes.client.V1Pod:
20
20
  metadata=kubernetes.client.V1ObjectMeta(
21
21
  name="gpustack-test",
22
22
  namespace="default",
23
- creation_timestamp=datetime(2026, 7, 29, 8, 0, 0, tzinfo=timezone.utc),
23
+ creation_timestamp=datetime(2026, 7, 29, 8, 0, 0, tzinfo=UTC),
24
24
  labels={"app": "test"},
25
25
  annotations=annotations,
26
26
  ),