Skip to content

Commit 5da03b4

Browse files
Merge pull request #31 from amd/alex_rocm_fix
Rocm plugin update to accommodate for changes in 7.0
2 parents 10ac319 + c3ca494 commit 5da03b4

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

nodescraper/plugins/inband/rocm/rocm_collector.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,34 @@ def collect_data(self, args=None) -> tuple[TaskResult, RocmDataModel | None]:
4343
Returns:
4444
tuple[TaskResult, RocmDataModel | None]: tuple containing the task result and ROCm data model if available.
4545
"""
46-
res = self._run_sut_cmd("cat /opt/rocm/.info/version")
47-
if res.exit_code == 0:
48-
rocm_data = RocmDataModel(rocm_version=res.stdout)
46+
version_paths = [
47+
"/opt/rocm/.info/version-rocm",
48+
"/opt/rocm/.info/version",
49+
]
50+
51+
rocm_data = None
52+
for path in version_paths:
53+
res = self._run_sut_cmd(f"grep . {path}")
54+
if res.exit_code == 0:
55+
rocm_data = RocmDataModel(rocm_version=res.stdout)
56+
self._log_event(
57+
category="ROCM_VERSION_READ",
58+
description="ROCm version data collected",
59+
data=rocm_data.model_dump(),
60+
priority=EventPriority.INFO,
61+
)
62+
self.result.message = f"ROCm: {rocm_data.model_dump()}"
63+
self.result.status = ExecutionStatus.OK
64+
break
65+
else:
4966
self._log_event(
50-
category="ROCM_VERSION_READ",
51-
description="ROCm version data collected",
52-
data=rocm_data.model_dump(),
53-
priority=EventPriority.INFO,
67+
category=EventCategory.OS,
68+
description=f"Unable to read ROCm version from {version_paths}",
69+
data={"raw_output": res.stdout},
70+
priority=EventPriority.ERROR,
5471
)
55-
self.result.message = f"ROCm: {rocm_data.model_dump()}"
56-
self.result.status = ExecutionStatus.OK
57-
else:
58-
rocm_data = None
72+
73+
if not rocm_data:
5974
self._log_event(
6075
category=EventCategory.OS,
6176
description="Error checking ROCm version",

nodescraper/plugins/inband/rocm/rocmdata.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ def validate_rocm_version(cls, rocm_version: str) -> str:
4848
Returns:
4949
str: The validated ROCm version string.
5050
"""
51-
if not bool(
52-
re.match(
53-
r"^(\d+(?:\.\d+){0,3})-(\d+)$",
54-
rocm_version,
55-
)
56-
):
51+
if not re.match(r"^\d+(?:\.\d+){0,3}(-\d+)?$", rocm_version):
5752
raise ValueError(f"ROCm version has invalid format: {rocm_version}")
58-
5953
return rocm_version

0 commit comments

Comments
 (0)