base.py 722 B

1234567891011121314151617181920212223242526
  1. from abc import ABC, abstractmethod
  2. from gpustack.schemas.workers import GPUDevicesStatus, SystemInfo
  3. class GPUDetector(ABC):
  4. @abstractmethod
  5. def is_available(self) -> bool:
  6. pass
  7. @abstractmethod
  8. def gather_gpu_info(self) -> GPUDevicesStatus:
  9. pass
  10. class SystemInfoDetector(ABC):
  11. @abstractmethod
  12. def gather_system_info(self) -> SystemInfo:
  13. pass
  14. # This exception assigns the error message to state_message and transitions the state to NOT_READY
  15. # Example: raise GPUDetectException("GPU device not detected in the system")
  16. # Then the state will be NOT_READY and state_message will be "GPU device not detected in the system"
  17. class GPUDetectExepction(Exception):
  18. pass