2323# SOFTWARE.
2424#
2525###############################################################################
26+ from pathlib import Path
27+
2628from nodescraper .base import InBandDataCollector
2729from nodescraper .enums import EventCategory , EventPriority , ExecutionStatus , OSFamily
2830from nodescraper .models import TaskResult
@@ -43,19 +45,35 @@ def collect_data(self, args=None) -> tuple[TaskResult, RocmDataModel | None]:
4345 Returns:
4446 tuple[TaskResult, RocmDataModel | None]: tuple containing the task result and ROCm data model if available.
4547 """
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 )
49- self ._log_event (
50- category = "ROCM_VERSION_READ" ,
51- description = "ROCm version data collected" ,
52- data = rocm_data .model_dump (),
53- priority = EventPriority .INFO ,
54- )
55- self .result .message = f"ROCm: { rocm_data .model_dump ()} "
56- self .result .status = ExecutionStatus .OK
57- else :
58- rocm_data = None
48+ version_paths = [
49+ "/opt/rocm/.info/version-rocm" ,
50+ "/opt/rocm/.info/version" ,
51+ ]
52+
53+ rocm_data = None
54+ for path in version_paths :
55+ if Path (path ).exists ():
56+ res = self ._run_sut_cmd (f"cat { path } " )
57+ if res .exit_code == 0 :
58+ rocm_data = RocmDataModel (rocm_version = res .stdout )
59+ self ._log_event (
60+ category = "ROCM_VERSION_READ" ,
61+ description = "ROCm version data collected" ,
62+ data = rocm_data .model_dump (),
63+ priority = EventPriority .INFO ,
64+ )
65+ self .result .message = f"ROCm: { rocm_data .model_dump ()} "
66+ self .result .status = ExecutionStatus .OK
67+ break
68+ else :
69+ self ._log_event (
70+ category = EventCategory .OS ,
71+ description = f"Could not get ROCm version format from { path } " ,
72+ data = {"raw_output" : res .stdout },
73+ priority = EventPriority .ERROR ,
74+ )
75+
76+ if not rocm_data :
5977 self ._log_event (
6078 category = EventCategory .OS ,
6179 description = "Error checking ROCm version" ,
0 commit comments