diff --git a/nodescraper/plugins/inband/rocm/rocm_collector.py b/nodescraper/plugins/inband/rocm/rocm_collector.py index 7a0b6cb..3c62e01 100644 --- a/nodescraper/plugins/inband/rocm/rocm_collector.py +++ b/nodescraper/plugins/inband/rocm/rocm_collector.py @@ -43,19 +43,34 @@ def collect_data(self, args=None) -> tuple[TaskResult, RocmDataModel | None]: Returns: tuple[TaskResult, RocmDataModel | None]: tuple containing the task result and ROCm data model if available. """ - res = self._run_sut_cmd("cat /opt/rocm/.info/version") - if res.exit_code == 0: - rocm_data = RocmDataModel(rocm_version=res.stdout) + version_paths = [ + "/opt/rocm/.info/version-rocm", + "/opt/rocm/.info/version", + ] + + rocm_data = None + for path in version_paths: + res = self._run_sut_cmd(f"grep . {path}") + if res.exit_code == 0: + rocm_data = RocmDataModel(rocm_version=res.stdout) + self._log_event( + category="ROCM_VERSION_READ", + description="ROCm version data collected", + data=rocm_data.model_dump(), + priority=EventPriority.INFO, + ) + self.result.message = f"ROCm: {rocm_data.model_dump()}" + self.result.status = ExecutionStatus.OK + break + else: self._log_event( - category="ROCM_VERSION_READ", - description="ROCm version data collected", - data=rocm_data.model_dump(), - priority=EventPriority.INFO, + category=EventCategory.OS, + description=f"Unable to read ROCm version from {version_paths}", + data={"raw_output": res.stdout}, + priority=EventPriority.ERROR, ) - self.result.message = f"ROCm: {rocm_data.model_dump()}" - self.result.status = ExecutionStatus.OK - else: - rocm_data = None + + if not rocm_data: self._log_event( category=EventCategory.OS, description="Error checking ROCm version", diff --git a/nodescraper/plugins/inband/rocm/rocmdata.py b/nodescraper/plugins/inband/rocm/rocmdata.py index 596f9b9..2c5388e 100644 --- a/nodescraper/plugins/inband/rocm/rocmdata.py +++ b/nodescraper/plugins/inband/rocm/rocmdata.py @@ -48,12 +48,6 @@ def validate_rocm_version(cls, rocm_version: str) -> str: Returns: str: The validated ROCm version string. """ - if not bool( - re.match( - r"^(\d+(?:\.\d+){0,3})-(\d+)$", - rocm_version, - ) - ): + if not re.match(r"^\d+(?:\.\d+){0,3}(-\d+)?$", rocm_version): raise ValueError(f"ROCm version has invalid format: {rocm_version}") - return rocm_version