Skip to content

Commit a233df6

Browse files
committed
cleanup
1 parent 8cc0aaa commit a233df6

4 files changed

Lines changed: 5 additions & 41 deletions

File tree

nodescraper/base/inbanddataplugin.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,14 @@ class InBandDataPlugin(
3939
DataPlugin[InBandConnectionManager, SSHConnectionParams, TDataModel, TCollectArg, TAnalyzeArg],
4040
Generic[TDataModel, TCollectArg, TAnalyzeArg],
4141
):
42-
"""Base class for in band plugins.
43-
44-
Supports loading and comparing plugin data from scraper run directories
45-
(e.g. for compare-runs). Subclasses get find_datamodel_path_in_run,
46-
load_datamodel_from_path, get_extracted_errors, and load_run_data.
47-
"""
42+
"""Base class for in band plugins."""
4843

4944
CONNECTION_TYPE = InBandConnectionManager
5045

5146
@classmethod
5247
def find_datamodel_path_in_run(cls, run_path: str) -> Optional[str]:
5348
"""Find this plugin's collector datamodel file under a scraper run directory.
5449
55-
Looks for <run_path>/<plugin_snake>/<collector_snake>/ with result.json
56-
whose parent matches this plugin, then a datamodel file (datamodel.json,
57-
<data_model_name>.json, or .log).
58-
5950
Args:
6051
run_path: Path to a scraper log run directory (e.g. scraper_logs_*).
6152
@@ -130,9 +121,6 @@ def load_datamodel_from_path(cls, dm_path: str) -> Optional[TDataModel]:
130121
def get_extracted_errors(cls, data_model: DataModel) -> Optional[list[str]]:
131122
"""Compute extracted errors from datamodel for compare-runs (in memory only).
132123
133-
Uses get_compare_content() on the datamodel and ANALYZER.get_error_matches
134-
if this plugin has an ANALYZER; otherwise returns None.
135-
136124
Args:
137125
data_model: Loaded DATA_MODEL instance.
138126
@@ -164,10 +152,6 @@ def get_extracted_errors(cls, data_model: DataModel) -> Optional[list[str]]:
164152
def load_run_data(cls, run_path: str) -> Optional[dict[str, Any]]:
165153
"""Load this plugin's run data from a scraper run directory for comparison.
166154
167-
Finds the datamodel file, loads it, and returns a JSON-serializable dict
168-
(model_dump) with optional "extracted_errors" if the plugin supports
169-
get_compare_content and ANALYZER.get_error_matches.
170-
171155
Args:
172156
run_path: Path to a scraper log run directory or to a datamodel file.
173157

nodescraper/cli/compare_runs.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,6 @@ def run_compare_runs(
362362
) -> None:
363363
"""Compare datamodels from two run log directories and log results.
364364
365-
For each plugin present in either run:
366-
- If plugin is only in one run, logs that it was not found in the other run.
367-
- If plugin is in both runs, computes diff and logs differences or 'no differences'.
368-
369365
Args:
370366
path1: Path to first run log directory.
371367
path2: Path to second run log directory.

nodescraper/plugins/inband/dmesg/run_compare.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,12 @@
3232

3333

3434
def find_dmesg_datamodel_path(run_path: str) -> Optional[str]:
35-
"""Find the DmesgPlugin collector datamodel under a scraper run directory.
36-
37-
Delegates to DmesgPlugin.find_datamodel_path_in_run (see InBandDataPlugin).
38-
"""
35+
"""Find the DmesgPlugin collector datamodel under a scraper run directory."""
3936
return DmesgPlugin.find_datamodel_path_in_run(run_path)
4037

4138

4239
def load_dmesg_data(path: str) -> Tuple[Optional[DmesgData], Optional[str]]:
43-
"""Load DmesgData from a scraper run directory or a datamodel file path.
44-
45-
Uses DmesgPlugin.load_datamodel_from_path and find_datamodel_path_in_run.
46-
"""
40+
"""Load DmesgData from a scraper run directory or a datamodel file path."""
4741
path = os.path.abspath(path)
4842
if not os.path.exists(path):
4943
return None, None
@@ -55,10 +49,7 @@ def load_dmesg_data(path: str) -> Tuple[Optional[DmesgData], Optional[str]]:
5549

5650

5751
def compute_extracted_errors(dm: DmesgData) -> list[str]:
58-
"""Apply DmesgPlugin analyzer regexes to dmesg content (in memory only).
59-
60-
Delegates to DmesgPlugin.get_extracted_errors.
61-
"""
52+
"""Apply DmesgPlugin analyzer regexes to dmesg content (in memory only)."""
6253
out = DmesgPlugin.get_extracted_errors(dm)
6354
return out if out is not None else []
6455

@@ -68,11 +59,7 @@ def compare_dmesg_runs(
6859
path2: str,
6960
logger: Optional[logging.Logger] = None,
7061
) -> Tuple[list[str], list[str], str, str]:
71-
"""Load two DmesgPlugin runs, compute extracted errors in memory, and compare.
72-
73-
Uses DmesgPlugin.load_run_data; same logic is available for any InBandDataPlugin
74-
via plugin.load_run_data and compare-runs.
75-
"""
62+
"""Load two DmesgPlugin runs, compute extracted errors in memory, and compare."""
7663
log = logger or logging.getLogger(__name__)
7764
label1 = os.path.basename(path1.rstrip(os.sep))
7865
label2 = os.path.basename(path2.rstrip(os.sep))

test/unit/framework/test_compare_runs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ def test_run_compare_runs_with_fixture_dirs(caplog, framework_fixtures_path):
137137
run_compare_runs(str(base), str(base), plugin_reg, logger)
138138
assert "Loading run 1" in caplog.text
139139
assert "Loading run 2" in caplog.text
140-
# Same dir twice: BiosPlugin should be found, no differences
141140
assert "Plugin" in caplog.text
142141
assert "No differences" in caplog.text or "difference" in caplog.text.lower()
143142

@@ -154,7 +153,6 @@ def test_run_compare_runs_sysctl_fixture(caplog, framework_fixtures_path):
154153
assert "Loading run 1" in caplog.text
155154
assert "Loading run 2" in caplog.text
156155
assert "Sysctl" in caplog.text or "sysctl" in caplog.text
157-
# Fixtures have different vm_swappiness etc. so we expect differences
158156
assert "difference" in caplog.text.lower() or "only in" in caplog.text.lower()
159157

160158

@@ -170,5 +168,4 @@ def test_run_compare_runs_one_run_missing_plugin(caplog, framework_fixtures_path
170168
run_compare_runs(str(run1), str(run2), plugin_reg, logger)
171169
assert "Loading run 1" in caplog.text
172170
assert "Loading run 2" in caplog.text
173-
# BiosPlugin in run1 only -> we should see "not found in run 2"
174171
assert "not found in run 2" in caplog.text or "NOT_RAN" in caplog.text

0 commit comments

Comments
 (0)