AIMVT-139: node-scraper offline dmesg adapter + full_dmesg_scan toggle#221
AIMVT-139: node-scraper offline dmesg adapter + full_dmesg_scan toggle#221speriaswamy-amd wants to merge 1 commit into
Conversation
…ggle Introduce cvs/lib/node_scraper_adapter.py for offline parsing via AMD node-scraper's DmesgAnalyzer (normalize events → flatten to legacy lines). Route full_dmesg_scan through the adapter by default (CVS_DMESG_PARSER), with automatic fallback to err_patterns_dict regex when legacy is selected or amd-node-scraper is unavailable. Co-authored-by: Cursor <cursoragent@cursor.com>
| plugin = DmesgPlugin(system_info=SystemInfo(name=node_name or DEFAULT_NODE_NAME)) | ||
| result = plugin.analyze( | ||
| data=DmesgData(dmesg_content=dmesg_content or ""), | ||
| analysis_args=analysis_args, | ||
| ) | ||
| return [_normalize_event(event) for event in result.events] |
There was a problem hiding this comment.
FYI you can also call plugin.run(collection=False, data=dmesg.log, analysis_args=analysis_args) this way the plugin returns the common DataPluginResult which you can later parse similarly for NicPlugin and other plugins you might be interested in.
| # Environment toggle selecting the dmesg parser backend: | ||
| # CVS_DMESG_PARSER=node-scraper (default) -> AMD node-scraper analyzer | ||
| # CVS_DMESG_PARSER=legacy -> historical err_patterns_dict regex | ||
| # Falls back to legacy automatically when node-scraper is not installed. |
There was a problem hiding this comment.
Do we need fall back mechanism? if we add node-scrapper to requiremets, all cvs installations will have it.
| tabulate | ||
|
|
||
| # AMD node-scraper: offline dmesg/log parsing (see cvs/lib/node_scraper_adapter.py) | ||
| amd-node-scraper >= 1.1.4 |
There was a problem hiding this comment.
1.1.7 is the latest version available
There was a problem hiding this comment.
is there a reason to hardcode the version? we are at 1.1.8 as of yesterday
| ) | ||
|
|
||
|
|
||
| def is_available() -> bool: |
There was a problem hiding this comment.
we can remove this, because node-scrapper will be a mandatory requirement for cvs
| return NODE_SCRAPER_AVAILABLE | ||
|
|
||
|
|
||
| def _require_node_scraper() -> None: |
There was a problem hiding this comment.
we can remove this, because node-scrapper will be a mandatory requirement for cvs
Summary
cvs/lib/node_scraper_adapter.pyto parse collected dmesg offline via AMD node-scraper'sDmesgAnalyzer(parse_dmesgnormalizes events;event_match_linesflattens to legacy{node: [lines]}strings).full_dmesg_scan()behindCVS_DMESG_PARSER(defaultnode-scraper;legacy/falseselectserr_patterns_dictregex). Auto-falls back to legacy whenamd-node-scraperis not installed.amd-node-scraper>=1.1.4torequirements.txtand unit tests for adapter + toggle behavior.Test plan
python -m unittest cvs.lib.unittests.test_node_scraper_adapter(requiresamd-node-scraperinstalled)python -m unittest cvs.lib.unittests.test_verify_lib.TestFullDmesgScanCVS_DMESG_PARSER=node-scraper(default) and confirmfull_dmesg_scancollectsdmesg --time-format iso -xCVS_DMESG_PARSER=legacyand confirm legacydmesg -T+ regex path still worksMade with Cursor