feat: add AmdMobileApuPlugin for Ryzen mobile PL1 power validation#235
Open
Vrinda12-tech wants to merge 2 commits into
Open
feat: add AmdMobileApuPlugin for Ryzen mobile PL1 power validation#235Vrinda12-tech wants to merge 2 commits into
Vrinda12-tech wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new in-band platform plugin (AmdMobileApuPlugin) intended to collect Ryzen mobile PL1 (powercap) and CPU temperature data from sysfs and validate PL1 against an expected value.
Changes:
- Introduces
AmdMobileApuPluginand its collector/analyzer/args/data model undernodescraper/plugins/platforms/mobile_apu/. - Exports
AmdMobileApuPluginfromnodescraper.plugins. - Adds PL1 mismatch validation logic with a fixed tolerance.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_plugin.py | Wires the new plugin class to its collector/analyzer/models. |
| nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_data_model.py | Adds the Pydantic data model for PL1 + CPU temp. |
| nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_collector.py | Adds sysfs-based collection logic for PL1 and CPU temp. |
| nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_analyzer.py | Adds PL1 validation logic and maps it to ExecutionStatus. |
| nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_analyzer_args.py | Adds analyzer args with optional expected PL1 limit. |
| nodescraper/plugins/platforms/mobile_apu/init.py | Declares the mobile_apu package (empty init). |
| nodescraper/plugins/init.py | Exposes AmdMobileApuPlugin at the package root. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+66
to
+72
| result = self.analyze(data, args) | ||
| status_map = { | ||
| "PASS": ExecutionStatus.OK, | ||
| "WARN": ExecutionStatus.WARNING, | ||
| "FAIL": ExecutionStatus.ERROR, | ||
| } | ||
| return TaskResult(status=status_map[result["status"]], message="; ".join(result["messages"])) No newline at end of file |
Comment on lines
+26
to
+43
| from pathlib import Path | ||
| from typing import Optional | ||
|
|
||
| from nodescraper.base import InBandDataCollector | ||
| from nodescraper.enums import ExecutionStatus | ||
| from nodescraper.models import TaskResult | ||
|
|
||
| from .amd_mobile_apu_data_model import AmdMobileApuDataModel | ||
|
|
||
|
|
||
| class AmdMobileApuCollector(InBandDataCollector[AmdMobileApuDataModel, None]): | ||
| DATA_MODEL = AmdMobileApuDataModel | ||
|
|
||
| def _read_int(self, path: str) -> int | None: | ||
| try: | ||
| return int(Path(path).read_text().strip()) | ||
| except (OSError, IOError, ValueError): | ||
| return None |
Comment on lines
+59
to
+62
| def collect_data( | ||
| self, args: Optional[None] = None | ||
| ) -> tuple[TaskResult, Optional[AmdMobileApuDataModel]]: | ||
| return TaskResult(status=ExecutionStatus.OK), self.collect() No newline at end of file |
| # SOFTWARE. | ||
| # | ||
| ############################################################################### | ||
| from pydantic import BaseModel, Field |
Comment on lines
+1
to
+5
|
|
||
|
|
||
| ############################################################################### | ||
| # | ||
| # MIT License |
Comment on lines
+26
to
+30
| from .platforms.mobile_apu.amd_mobile_apu_plugin import AmdMobileApuPlugin | ||
|
|
||
| __all__ = [ | ||
| "AmdMobileApuPlugin", | ||
| ] |
Comment on lines
+39
to
+44
| def analyze( | ||
| self, | ||
| data_model: AmdMobileApuDataModel, | ||
| analyzer_args: AmdMobileApuAnalyzerArgs | None = None, | ||
| ): | ||
| if data_model.pl1_power_limit_mw is None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
AmdMobileApuPluginfor AMD mobile APUs (Ryzen 5 5600H)./sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw(converted to mW) and CPU temp from/sys/class/thermal/thermal_zone0/temp.exp_pl1_power_limit_mw(tolerance: ±1000 mW).pl1_power_limit_mwandcpu_temp_millidegree.Testing
Related Issue
Closes #229
Checklist
plugins/__init__.py.docs/PLUGIN_DOC.md.development.platforms/mobile_apu/per maintainer request.pytest test/functional(if applicable)pre-commit run --all-filesChecklist