Skip to content

Commit b4b5b75

Browse files
committed
addressed reviews
1 parent b36ad92 commit b4b5b75

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

nodescraper/plugins/inband/rocm/rocm_collector.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
# SOFTWARE.
2424
#
2525
###############################################################################
26-
from pathlib import Path
27-
2826
from nodescraper.base import InBandDataCollector
2927
from nodescraper.enums import EventCategory, EventPriority, ExecutionStatus, OSFamily
3028
from nodescraper.models import TaskResult
@@ -52,26 +50,25 @@ def collect_data(self, args=None) -> tuple[TaskResult, RocmDataModel | None]:
5250

5351
rocm_data = None
5452
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-
)
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:
66+
self._log_event(
67+
category=EventCategory.OS,
68+
description=f"Could not get ROCm version format from {path}",
69+
data={"raw_output": res.stdout},
70+
priority=EventPriority.ERROR,
71+
)
7572

7673
if not rocm_data:
7774
self._log_event(

0 commit comments

Comments
 (0)