amd-node-scraper 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- amd_node_scraper-0.0.1.dist-info/LICENSE +21 -0
- amd_node_scraper-0.0.1.dist-info/METADATA +424 -0
- amd_node_scraper-0.0.1.dist-info/RECORD +197 -0
- amd_node_scraper-0.0.1.dist-info/WHEEL +5 -0
- amd_node_scraper-0.0.1.dist-info/entry_points.txt +2 -0
- amd_node_scraper-0.0.1.dist-info/top_level.txt +1 -0
- nodescraper/__init__.py +32 -0
- nodescraper/base/__init__.py +34 -0
- nodescraper/base/inbandcollectortask.py +118 -0
- nodescraper/base/inbanddataplugin.py +39 -0
- nodescraper/base/regexanalyzer.py +120 -0
- nodescraper/cli/__init__.py +29 -0
- nodescraper/cli/cli.py +511 -0
- nodescraper/cli/constants.py +27 -0
- nodescraper/cli/dynamicparserbuilder.py +171 -0
- nodescraper/cli/helper.py +517 -0
- nodescraper/cli/inputargtypes.py +129 -0
- nodescraper/configbuilder.py +123 -0
- nodescraper/configregistry.py +66 -0
- nodescraper/configs/node_status.json +19 -0
- nodescraper/connection/__init__.py +25 -0
- nodescraper/connection/inband/__init__.py +46 -0
- nodescraper/connection/inband/inband.py +171 -0
- nodescraper/connection/inband/inbandlocal.py +93 -0
- nodescraper/connection/inband/inbandmanager.py +151 -0
- nodescraper/connection/inband/inbandremote.py +173 -0
- nodescraper/connection/inband/sshparams.py +43 -0
- nodescraper/constants.py +26 -0
- nodescraper/enums/__init__.py +40 -0
- nodescraper/enums/eventcategory.py +89 -0
- nodescraper/enums/eventpriority.py +42 -0
- nodescraper/enums/executionstatus.py +44 -0
- nodescraper/enums/osfamily.py +34 -0
- nodescraper/enums/systeminteraction.py +41 -0
- nodescraper/enums/systemlocation.py +33 -0
- nodescraper/generictypes.py +36 -0
- nodescraper/interfaces/__init__.py +44 -0
- nodescraper/interfaces/connectionmanager.py +143 -0
- nodescraper/interfaces/dataanalyzertask.py +138 -0
- nodescraper/interfaces/datacollectortask.py +185 -0
- nodescraper/interfaces/dataplugin.py +356 -0
- nodescraper/interfaces/plugin.py +127 -0
- nodescraper/interfaces/resultcollator.py +56 -0
- nodescraper/interfaces/task.py +164 -0
- nodescraper/interfaces/taskresulthook.py +39 -0
- nodescraper/models/__init__.py +48 -0
- nodescraper/models/analyzerargs.py +93 -0
- nodescraper/models/collectorargs.py +30 -0
- nodescraper/models/connectionconfig.py +34 -0
- nodescraper/models/datamodel.py +171 -0
- nodescraper/models/datapluginresult.py +39 -0
- nodescraper/models/event.py +158 -0
- nodescraper/models/pluginconfig.py +38 -0
- nodescraper/models/pluginresult.py +39 -0
- nodescraper/models/systeminfo.py +44 -0
- nodescraper/models/taskresult.py +185 -0
- nodescraper/models/timerangeargs.py +38 -0
- nodescraper/pluginexecutor.py +274 -0
- nodescraper/pluginregistry.py +152 -0
- nodescraper/plugins/__init__.py +25 -0
- nodescraper/plugins/inband/__init__.py +25 -0
- nodescraper/plugins/inband/amdsmi/__init__.py +28 -0
- nodescraper/plugins/inband/amdsmi/amdsmi_analyzer.py +821 -0
- nodescraper/plugins/inband/amdsmi/amdsmi_collector.py +1313 -0
- nodescraper/plugins/inband/amdsmi/amdsmi_plugin.py +43 -0
- nodescraper/plugins/inband/amdsmi/amdsmidata.py +1002 -0
- nodescraper/plugins/inband/amdsmi/analyzer_args.py +50 -0
- nodescraper/plugins/inband/amdsmi/cper.py +65 -0
- nodescraper/plugins/inband/bios/__init__.py +29 -0
- nodescraper/plugins/inband/bios/analyzer_args.py +64 -0
- nodescraper/plugins/inband/bios/bios_analyzer.py +93 -0
- nodescraper/plugins/inband/bios/bios_collector.py +93 -0
- nodescraper/plugins/inband/bios/bios_plugin.py +43 -0
- nodescraper/plugins/inband/bios/biosdata.py +30 -0
- nodescraper/plugins/inband/cmdline/__init__.py +25 -0
- nodescraper/plugins/inband/cmdline/analyzer_args.py +80 -0
- nodescraper/plugins/inband/cmdline/cmdline_analyzer.py +113 -0
- nodescraper/plugins/inband/cmdline/cmdline_collector.py +77 -0
- nodescraper/plugins/inband/cmdline/cmdline_plugin.py +43 -0
- nodescraper/plugins/inband/cmdline/cmdlinedata.py +30 -0
- nodescraper/plugins/inband/device_enumeration/__init__.py +29 -0
- nodescraper/plugins/inband/device_enumeration/analyzer_args.py +73 -0
- nodescraper/plugins/inband/device_enumeration/device_enumeration_analyzer.py +81 -0
- nodescraper/plugins/inband/device_enumeration/device_enumeration_collector.py +176 -0
- nodescraper/plugins/inband/device_enumeration/device_enumeration_plugin.py +45 -0
- nodescraper/plugins/inband/device_enumeration/deviceenumdata.py +36 -0
- nodescraper/plugins/inband/dimm/__init__.py +25 -0
- nodescraper/plugins/inband/dimm/collector_args.py +31 -0
- nodescraper/plugins/inband/dimm/dimm_collector.py +151 -0
- nodescraper/plugins/inband/dimm/dimm_plugin.py +40 -0
- nodescraper/plugins/inband/dimm/dimmdata.py +30 -0
- nodescraper/plugins/inband/dkms/__init__.py +25 -0
- nodescraper/plugins/inband/dkms/analyzer_args.py +85 -0
- nodescraper/plugins/inband/dkms/dkms_analyzer.py +106 -0
- nodescraper/plugins/inband/dkms/dkms_collector.py +76 -0
- nodescraper/plugins/inband/dkms/dkms_plugin.py +43 -0
- nodescraper/plugins/inband/dkms/dkmsdata.py +33 -0
- nodescraper/plugins/inband/dmesg/__init__.py +28 -0
- nodescraper/plugins/inband/dmesg/analyzer_args.py +33 -0
- nodescraper/plugins/inband/dmesg/collector_args.py +39 -0
- nodescraper/plugins/inband/dmesg/dmesg_analyzer.py +503 -0
- nodescraper/plugins/inband/dmesg/dmesg_collector.py +164 -0
- nodescraper/plugins/inband/dmesg/dmesg_plugin.py +44 -0
- nodescraper/plugins/inband/dmesg/dmesgdata.py +116 -0
- nodescraper/plugins/inband/fabrics/__init__.py +28 -0
- nodescraper/plugins/inband/fabrics/fabrics_collector.py +726 -0
- nodescraper/plugins/inband/fabrics/fabrics_plugin.py +37 -0
- nodescraper/plugins/inband/fabrics/fabricsdata.py +140 -0
- nodescraper/plugins/inband/journal/__init__.py +28 -0
- nodescraper/plugins/inband/journal/collector_args.py +33 -0
- nodescraper/plugins/inband/journal/journal_collector.py +107 -0
- nodescraper/plugins/inband/journal/journal_plugin.py +40 -0
- nodescraper/plugins/inband/journal/journaldata.py +44 -0
- nodescraper/plugins/inband/kernel/__init__.py +25 -0
- nodescraper/plugins/inband/kernel/analyzer_args.py +64 -0
- nodescraper/plugins/inband/kernel/kernel_analyzer.py +91 -0
- nodescraper/plugins/inband/kernel/kernel_collector.py +129 -0
- nodescraper/plugins/inband/kernel/kernel_plugin.py +43 -0
- nodescraper/plugins/inband/kernel/kerneldata.py +32 -0
- nodescraper/plugins/inband/kernel_module/__init__.py +25 -0
- nodescraper/plugins/inband/kernel_module/analyzer_args.py +59 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_analyzer.py +211 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_collector.py +264 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_data.py +60 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_plugin.py +43 -0
- nodescraper/plugins/inband/memory/__init__.py +25 -0
- nodescraper/plugins/inband/memory/analyzer_args.py +45 -0
- nodescraper/plugins/inband/memory/memory_analyzer.py +98 -0
- nodescraper/plugins/inband/memory/memory_collector.py +330 -0
- nodescraper/plugins/inband/memory/memory_plugin.py +43 -0
- nodescraper/plugins/inband/memory/memorydata.py +90 -0
- nodescraper/plugins/inband/network/__init__.py +28 -0
- nodescraper/plugins/inband/network/network_collector.py +1828 -0
- nodescraper/plugins/inband/network/network_plugin.py +37 -0
- nodescraper/plugins/inband/network/networkdata.py +319 -0
- nodescraper/plugins/inband/nvme/__init__.py +28 -0
- nodescraper/plugins/inband/nvme/nvme_collector.py +167 -0
- nodescraper/plugins/inband/nvme/nvme_plugin.py +37 -0
- nodescraper/plugins/inband/nvme/nvmedata.py +45 -0
- nodescraper/plugins/inband/os/__init__.py +25 -0
- nodescraper/plugins/inband/os/analyzer_args.py +64 -0
- nodescraper/plugins/inband/os/os_analyzer.py +73 -0
- nodescraper/plugins/inband/os/os_collector.py +131 -0
- nodescraper/plugins/inband/os/os_plugin.py +43 -0
- nodescraper/plugins/inband/os/osdata.py +31 -0
- nodescraper/plugins/inband/package/__init__.py +25 -0
- nodescraper/plugins/inband/package/analyzer_args.py +48 -0
- nodescraper/plugins/inband/package/package_analyzer.py +253 -0
- nodescraper/plugins/inband/package/package_collector.py +273 -0
- nodescraper/plugins/inband/package/package_plugin.py +43 -0
- nodescraper/plugins/inband/package/packagedata.py +41 -0
- nodescraper/plugins/inband/pcie/__init__.py +29 -0
- nodescraper/plugins/inband/pcie/analyzer_args.py +63 -0
- nodescraper/plugins/inband/pcie/pcie_analyzer.py +1081 -0
- nodescraper/plugins/inband/pcie/pcie_collector.py +690 -0
- nodescraper/plugins/inband/pcie/pcie_data.py +2017 -0
- nodescraper/plugins/inband/pcie/pcie_plugin.py +43 -0
- nodescraper/plugins/inband/process/__init__.py +25 -0
- nodescraper/plugins/inband/process/analyzer_args.py +45 -0
- nodescraper/plugins/inband/process/collector_args.py +31 -0
- nodescraper/plugins/inband/process/process_analyzer.py +91 -0
- nodescraper/plugins/inband/process/process_collector.py +115 -0
- nodescraper/plugins/inband/process/process_plugin.py +46 -0
- nodescraper/plugins/inband/process/processdata.py +34 -0
- nodescraper/plugins/inband/rocm/__init__.py +25 -0
- nodescraper/plugins/inband/rocm/analyzer_args.py +66 -0
- nodescraper/plugins/inband/rocm/rocm_analyzer.py +100 -0
- nodescraper/plugins/inband/rocm/rocm_collector.py +205 -0
- nodescraper/plugins/inband/rocm/rocm_plugin.py +43 -0
- nodescraper/plugins/inband/rocm/rocmdata.py +62 -0
- nodescraper/plugins/inband/storage/__init__.py +25 -0
- nodescraper/plugins/inband/storage/analyzer_args.py +38 -0
- nodescraper/plugins/inband/storage/collector_args.py +31 -0
- nodescraper/plugins/inband/storage/storage_analyzer.py +152 -0
- nodescraper/plugins/inband/storage/storage_collector.py +110 -0
- nodescraper/plugins/inband/storage/storage_plugin.py +44 -0
- nodescraper/plugins/inband/storage/storagedata.py +70 -0
- nodescraper/plugins/inband/sysctl/__init__.py +29 -0
- nodescraper/plugins/inband/sysctl/analyzer_args.py +67 -0
- nodescraper/plugins/inband/sysctl/sysctl_analyzer.py +81 -0
- nodescraper/plugins/inband/sysctl/sysctl_collector.py +101 -0
- nodescraper/plugins/inband/sysctl/sysctl_plugin.py +43 -0
- nodescraper/plugins/inband/sysctl/sysctldata.py +42 -0
- nodescraper/plugins/inband/syslog/__init__.py +28 -0
- nodescraper/plugins/inband/syslog/syslog_collector.py +121 -0
- nodescraper/plugins/inband/syslog/syslog_plugin.py +37 -0
- nodescraper/plugins/inband/syslog/syslogdata.py +46 -0
- nodescraper/plugins/inband/uptime/__init__.py +25 -0
- nodescraper/plugins/inband/uptime/uptime_collector.py +88 -0
- nodescraper/plugins/inband/uptime/uptime_plugin.py +37 -0
- nodescraper/plugins/inband/uptime/uptimedata.py +31 -0
- nodescraper/resultcollators/__init__.py +25 -0
- nodescraper/resultcollators/tablesummary.py +159 -0
- nodescraper/taskresulthooks/__init__.py +28 -0
- nodescraper/taskresulthooks/filesystemloghook.py +88 -0
- nodescraper/typeutils.py +171 -0
- nodescraper/utils.py +412 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from nodescraper.base import InBandDataPlugin
|
|
27
|
+
|
|
28
|
+
from .analyzer_args import PcieAnalyzerArgs
|
|
29
|
+
from .pcie_analyzer import PcieAnalyzer
|
|
30
|
+
from .pcie_collector import PcieCollector
|
|
31
|
+
from .pcie_data import PcieDataModel
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class PciePlugin(InBandDataPlugin[PcieDataModel, None, PcieAnalyzerArgs]):
|
|
35
|
+
"""Plugin for collection and analysis of PCIe data"""
|
|
36
|
+
|
|
37
|
+
DATA_MODEL = PcieDataModel
|
|
38
|
+
|
|
39
|
+
COLLECTOR = PcieCollector
|
|
40
|
+
|
|
41
|
+
ANALYZER = PcieAnalyzer
|
|
42
|
+
|
|
43
|
+
ANALYZER_ARGS = PcieAnalyzerArgs
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
|
|
27
|
+
from nodescraper.models import AnalyzerArgs
|
|
28
|
+
from nodescraper.plugins.inband.process.processdata import ProcessDataModel
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ProcessAnalyzerArgs(AnalyzerArgs):
|
|
32
|
+
max_kfd_processes: int = 0
|
|
33
|
+
max_cpu_usage: float = 20.0
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def build_from_model(cls, datamodel: ProcessDataModel) -> "ProcessAnalyzerArgs":
|
|
37
|
+
"""build analyzer args from data model
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
datamodel (ProcessDataModel): data model for plugin
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
ProcessAnalyzerArgs: instance of analyzer args class
|
|
44
|
+
"""
|
|
45
|
+
return cls(max_kfd_processes=datamodel.kfd_process, max_cpu_usage=datamodel.cpu_usage)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
|
|
27
|
+
from nodescraper.models import CollectorArgs
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ProcessCollectorArgs(CollectorArgs):
|
|
31
|
+
top_n_process: int = 10
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from typing import Optional
|
|
27
|
+
|
|
28
|
+
from nodescraper.enums import EventCategory, EventPriority, ExecutionStatus
|
|
29
|
+
from nodescraper.interfaces import DataAnalyzer
|
|
30
|
+
from nodescraper.models import TaskResult
|
|
31
|
+
|
|
32
|
+
from .analyzer_args import ProcessAnalyzerArgs
|
|
33
|
+
from .processdata import ProcessDataModel
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ProcessAnalyzer(DataAnalyzer[ProcessDataModel, ProcessAnalyzerArgs]):
|
|
37
|
+
"""Check cpu and kfd processes are within allowed maximum cpu and gpu usage"""
|
|
38
|
+
|
|
39
|
+
DATA_MODEL = ProcessDataModel
|
|
40
|
+
|
|
41
|
+
def analyze_data(
|
|
42
|
+
self, data: ProcessDataModel, args: Optional[ProcessAnalyzerArgs] = None
|
|
43
|
+
) -> TaskResult:
|
|
44
|
+
"""
|
|
45
|
+
Analyze the process data to check if the number of KFD processes and CPU usage
|
|
46
|
+
are within the allowed limits.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
data (ProcessDataModel): The process data to analyze.
|
|
50
|
+
args (Optional[ProcessAnalyzerArgs], optional): The process analysis arguments. Defaults to None.
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
TaskResult: The result of the analysis, containing any events logged during the process.
|
|
54
|
+
"""
|
|
55
|
+
if not args:
|
|
56
|
+
args = ProcessAnalyzerArgs()
|
|
57
|
+
|
|
58
|
+
err_messages = []
|
|
59
|
+
if data.kfd_process is not None and data.kfd_process > args.max_kfd_processes:
|
|
60
|
+
err_messages.append(
|
|
61
|
+
f"Kfd processes {data.kfd_process} exeed max limit {args.max_kfd_processes}"
|
|
62
|
+
)
|
|
63
|
+
self._log_event(
|
|
64
|
+
category=EventCategory.OS,
|
|
65
|
+
description="Kfd processes exceed maximum limit",
|
|
66
|
+
data={
|
|
67
|
+
"kfd_process": data.kfd_process,
|
|
68
|
+
"kfd_process_limit": args.max_kfd_processes,
|
|
69
|
+
},
|
|
70
|
+
priority=EventPriority.CRITICAL,
|
|
71
|
+
console_log=True,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
if data.cpu_usage is not None and data.cpu_usage > args.max_cpu_usage:
|
|
75
|
+
err_messages.append(f"CPU usage {data.cpu_usage} exceeds limit {args.max_cpu_usage}")
|
|
76
|
+
self._log_event(
|
|
77
|
+
category=EventCategory.OS,
|
|
78
|
+
description="CPU usage exceeds maximum limit",
|
|
79
|
+
data={
|
|
80
|
+
"cpu_usage": data.cpu_usage,
|
|
81
|
+
"cpu_usage_limit": args.max_cpu_usage,
|
|
82
|
+
},
|
|
83
|
+
priority=EventPriority.CRITICAL,
|
|
84
|
+
console_log=True,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
if err_messages:
|
|
88
|
+
self.result.status = ExecutionStatus.ERROR
|
|
89
|
+
self.result.message = ". ".join(err_messages)
|
|
90
|
+
|
|
91
|
+
return self.result
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
import re
|
|
27
|
+
from typing import Optional
|
|
28
|
+
|
|
29
|
+
from nodescraper.base import InBandDataCollector
|
|
30
|
+
from nodescraper.enums import EventCategory, EventPriority, ExecutionStatus, OSFamily
|
|
31
|
+
from nodescraper.models import TaskResult
|
|
32
|
+
|
|
33
|
+
from .collector_args import ProcessCollectorArgs
|
|
34
|
+
from .processdata import ProcessDataModel
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ProcessCollector(InBandDataCollector[ProcessDataModel, ProcessCollectorArgs]):
|
|
38
|
+
"""Collect Process details"""
|
|
39
|
+
|
|
40
|
+
SUPPORTED_OS_FAMILY: set[OSFamily] = {OSFamily.LINUX}
|
|
41
|
+
|
|
42
|
+
DATA_MODEL = ProcessDataModel
|
|
43
|
+
CMD_KFD = "rocm-smi --showpids"
|
|
44
|
+
CMD_CPU_USAGE = "top -b -n 1"
|
|
45
|
+
CMD_PROCESS = "top -b -n 1 -o %CPU "
|
|
46
|
+
|
|
47
|
+
def collect_data(
|
|
48
|
+
self, args: Optional[ProcessCollectorArgs] = None
|
|
49
|
+
) -> tuple[TaskResult, Optional[ProcessDataModel]]:
|
|
50
|
+
"""Collect process data from the system.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
args (Optional[ProcessCollectorArgs], optional): process collection arguments. Defaults to None.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
tuple[TaskResult, Optional[ProcessDataModel]]: tuple containing the task result and the collected process data model or None if no data was collected.
|
|
57
|
+
"""
|
|
58
|
+
if args is None:
|
|
59
|
+
args = ProcessCollectorArgs()
|
|
60
|
+
|
|
61
|
+
process_data = ProcessDataModel()
|
|
62
|
+
process_data.processes = []
|
|
63
|
+
|
|
64
|
+
kfd_process = self._run_sut_cmd(self.CMD_KFD)
|
|
65
|
+
if kfd_process.exit_code == 0:
|
|
66
|
+
if "No KFD PIDs currently running" in kfd_process.stdout:
|
|
67
|
+
process_data.kfd_process = 0
|
|
68
|
+
else:
|
|
69
|
+
kfd_process = re.findall(
|
|
70
|
+
r"^\s*\d+\s+[\w]+\s+\d+\s+\d+\s+\d+\s+\d+",
|
|
71
|
+
kfd_process.stdout,
|
|
72
|
+
re.MULTILINE,
|
|
73
|
+
)
|
|
74
|
+
process_data.kfd_process = len(kfd_process)
|
|
75
|
+
|
|
76
|
+
cpu_usage = self._run_sut_cmd(self.CMD_CPU_USAGE)
|
|
77
|
+
if cpu_usage.exit_code == 0:
|
|
78
|
+
cpu_idle = (
|
|
79
|
+
[line for line in cpu_usage.stdout.splitlines() if "Cpu(s)" in line][0]
|
|
80
|
+
.split(",")[3]
|
|
81
|
+
.split()[0]
|
|
82
|
+
.replace("%id", "")
|
|
83
|
+
)
|
|
84
|
+
process_data.cpu_usage = 100 - float(cpu_idle)
|
|
85
|
+
|
|
86
|
+
processes = self._run_sut_cmd(
|
|
87
|
+
f"self.CMD_PROCESS | sed -n '8,{args.top_n_process + 7}p'"
|
|
88
|
+
) # Remove system header
|
|
89
|
+
if processes.exit_code == 0:
|
|
90
|
+
for line in processes.stdout.splitlines():
|
|
91
|
+
columns = line.split()
|
|
92
|
+
process_cpu_usage = columns[8]
|
|
93
|
+
process_name = columns[11]
|
|
94
|
+
process_data.processes.append((process_name, process_cpu_usage))
|
|
95
|
+
|
|
96
|
+
process_check = bool(process_data.model_fields_set)
|
|
97
|
+
if process_check:
|
|
98
|
+
self._log_event(
|
|
99
|
+
category="PROCESS_READ",
|
|
100
|
+
description="Process data collected",
|
|
101
|
+
data=process_data.model_dump(),
|
|
102
|
+
priority=EventPriority.INFO,
|
|
103
|
+
)
|
|
104
|
+
self.result.message = "Process data collected"
|
|
105
|
+
self.result.status = ExecutionStatus.OK
|
|
106
|
+
return self.result, process_data
|
|
107
|
+
else:
|
|
108
|
+
self._log_event(
|
|
109
|
+
category=EventCategory.OS,
|
|
110
|
+
description="Process data not found",
|
|
111
|
+
priority=EventPriority.ERROR,
|
|
112
|
+
)
|
|
113
|
+
self.result.message = "Process data not found"
|
|
114
|
+
self.result.status = ExecutionStatus.ERROR
|
|
115
|
+
return self.result, None
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from nodescraper.base import InBandDataPlugin
|
|
27
|
+
|
|
28
|
+
from .analyzer_args import ProcessAnalyzerArgs
|
|
29
|
+
from .collector_args import ProcessCollectorArgs
|
|
30
|
+
from .process_analyzer import ProcessAnalyzer
|
|
31
|
+
from .process_collector import ProcessCollector
|
|
32
|
+
from .processdata import ProcessDataModel
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ProcessPlugin(InBandDataPlugin[ProcessDataModel, ProcessCollectorArgs, ProcessAnalyzerArgs]):
|
|
36
|
+
"""Plugin for collection and analysis of process data"""
|
|
37
|
+
|
|
38
|
+
DATA_MODEL = ProcessDataModel
|
|
39
|
+
|
|
40
|
+
COLLECTOR = ProcessCollector
|
|
41
|
+
|
|
42
|
+
ANALYZER = ProcessAnalyzer
|
|
43
|
+
|
|
44
|
+
ANALYZER_ARGS = ProcessAnalyzerArgs
|
|
45
|
+
|
|
46
|
+
COLLECTOR_ARGS = ProcessCollectorArgs
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from typing import Optional
|
|
27
|
+
|
|
28
|
+
from nodescraper.models import DataModel
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ProcessDataModel(DataModel):
|
|
32
|
+
kfd_process: Optional[int] = None
|
|
33
|
+
cpu_usage: Optional[float] = None
|
|
34
|
+
processes: Optional[list[tuple[str, str]]] = None
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from typing import Union
|
|
27
|
+
|
|
28
|
+
from pydantic import Field, field_validator
|
|
29
|
+
|
|
30
|
+
from nodescraper.models.analyzerargs import AnalyzerArgs
|
|
31
|
+
from nodescraper.plugins.inband.rocm.rocmdata import RocmDataModel
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class RocmAnalyzerArgs(AnalyzerArgs):
|
|
35
|
+
exp_rocm: Union[str, list] = Field(default_factory=list)
|
|
36
|
+
exp_rocm_latest: str = Field(default="")
|
|
37
|
+
|
|
38
|
+
@field_validator("exp_rocm", mode="before")
|
|
39
|
+
@classmethod
|
|
40
|
+
def validate_exp_rocm(cls, exp_rocm: Union[str, list]) -> list:
|
|
41
|
+
"""support str or list input for exp_rocm
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
exp_rocm (Union[str, list]): exp_rocm input
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
list: exp_rocm list
|
|
48
|
+
"""
|
|
49
|
+
if isinstance(exp_rocm, str):
|
|
50
|
+
exp_rocm = [exp_rocm]
|
|
51
|
+
|
|
52
|
+
return exp_rocm
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def build_from_model(cls, datamodel: RocmDataModel) -> "RocmAnalyzerArgs":
|
|
56
|
+
"""build analyzer args from data model
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
datamodel (RocmDataModel): data model for plugin
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
RocmAnalyzerArgs: instance of analyzer args class
|
|
63
|
+
"""
|
|
64
|
+
return cls(
|
|
65
|
+
exp_rocm=datamodel.rocm_version, exp_rocm_latest=datamodel.rocm_latest_versioned_path
|
|
66
|
+
)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from typing import Optional
|
|
27
|
+
|
|
28
|
+
from nodescraper.enums import EventCategory, EventPriority, ExecutionStatus
|
|
29
|
+
from nodescraper.interfaces import DataAnalyzer
|
|
30
|
+
from nodescraper.models import TaskResult
|
|
31
|
+
|
|
32
|
+
from .analyzer_args import RocmAnalyzerArgs
|
|
33
|
+
from .rocmdata import RocmDataModel
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class RocmAnalyzer(DataAnalyzer[RocmDataModel, RocmAnalyzerArgs]):
|
|
37
|
+
"""Check ROCm matches expected versions"""
|
|
38
|
+
|
|
39
|
+
DATA_MODEL = RocmDataModel
|
|
40
|
+
|
|
41
|
+
def analyze_data(
|
|
42
|
+
self, data: RocmDataModel, args: Optional[RocmAnalyzerArgs] = None
|
|
43
|
+
) -> TaskResult:
|
|
44
|
+
"""
|
|
45
|
+
Analyze the provided ROCm data against expected versions.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
data (RocmDataModel): ROCm data to analyze
|
|
49
|
+
args (Optional[RocmAnalyzerArgs], optional): ROCm analysis arguments. Defaults to None.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
TaskResult: Result of the analysis containing status and message.
|
|
53
|
+
"""
|
|
54
|
+
# skip check if data not provided in config
|
|
55
|
+
if not args or not args.exp_rocm:
|
|
56
|
+
self.result.message = "Expected ROCm not provided"
|
|
57
|
+
self.result.status = ExecutionStatus.NOT_RAN
|
|
58
|
+
return self.result
|
|
59
|
+
|
|
60
|
+
for rocm_version in args.exp_rocm:
|
|
61
|
+
if data.rocm_version == rocm_version:
|
|
62
|
+
self.result.message = "ROCm version matches expected"
|
|
63
|
+
self.result.status = ExecutionStatus.OK
|
|
64
|
+
break
|
|
65
|
+
else:
|
|
66
|
+
# No matching version found
|
|
67
|
+
self.result.message = (
|
|
68
|
+
f"ROCm version mismatch! Expected: {args.exp_rocm}, actual: {data.rocm_version}"
|
|
69
|
+
)
|
|
70
|
+
self.result.status = ExecutionStatus.ERROR
|
|
71
|
+
self._log_event(
|
|
72
|
+
category=EventCategory.SW_DRIVER,
|
|
73
|
+
description=f"{self.result.message}",
|
|
74
|
+
data={"expected": args.exp_rocm, "actual": data.rocm_version},
|
|
75
|
+
priority=EventPriority.CRITICAL,
|
|
76
|
+
console_log=True,
|
|
77
|
+
)
|
|
78
|
+
return self.result
|
|
79
|
+
|
|
80
|
+
# validate rocm_latest if provided in args
|
|
81
|
+
if args.exp_rocm_latest:
|
|
82
|
+
if data.rocm_latest_versioned_path != args.exp_rocm_latest:
|
|
83
|
+
self.result.message = f"ROCm latest path mismatch! Expected: {args.exp_rocm_latest}, actual: {data.rocm_latest_versioned_path}"
|
|
84
|
+
self.result.status = ExecutionStatus.ERROR
|
|
85
|
+
self._log_event(
|
|
86
|
+
category=EventCategory.SW_DRIVER,
|
|
87
|
+
description=f"{self.result.message}",
|
|
88
|
+
data={
|
|
89
|
+
"expected": args.exp_rocm_latest,
|
|
90
|
+
"actual": data.rocm_latest_versioned_path,
|
|
91
|
+
},
|
|
92
|
+
priority=EventPriority.CRITICAL,
|
|
93
|
+
console_log=True,
|
|
94
|
+
)
|
|
95
|
+
return self.result
|
|
96
|
+
else:
|
|
97
|
+
# Update message to include rocm_latest validation result
|
|
98
|
+
self.result.message = f"ROCm version matches expected. ROCm latest path validated: {data.rocm_latest_versioned_path}"
|
|
99
|
+
|
|
100
|
+
return self.result
|