custom.py 681 B

12345678910111213141516171819202122232425
  1. from typing import Optional
  2. from gpustack.detectors.base import GPUDetector, SystemInfoDetector
  3. from gpustack.schemas.workers import (
  4. GPUDevicesStatus,
  5. SystemInfo,
  6. )
  7. class Custom(GPUDetector, SystemInfoDetector):
  8. def __init__(
  9. self,
  10. gpu_devices: Optional[GPUDevicesStatus] = None,
  11. system_info: Optional[SystemInfo] = None,
  12. ) -> None:
  13. self._gpu_devices = gpu_devices
  14. self._system_info = system_info
  15. def is_available(self) -> bool:
  16. return True
  17. def gather_gpu_info(self) -> GPUDevicesStatus:
  18. return self._gpu_devices
  19. def gather_system_info(self) -> SystemInfo:
  20. return self._system_info