2525###############################################################################
2626import io
2727from collections import defaultdict
28- from typing import Any , Dict , List , Optional , Union
28+ from typing import Any , Optional , Union
2929
3030from nodescraper .enums import EventCategory , EventPriority
3131from nodescraper .interfaces import DataAnalyzer
@@ -53,16 +53,16 @@ class AmdSmiAnalyzer(CperAnalysisTaskMixin, DataAnalyzer[AmdSmiDataModel, None])
5353
5454 def check_expected_max_power (
5555 self ,
56- amdsmi_static_data : List [AmdSmiStatic ],
56+ amdsmi_static_data : list [AmdSmiStatic ],
5757 expected_max_power : int ,
5858 ):
5959 """Check against expected max power
6060
6161 Args:
62- amdsmi_static_data (List [AmdSmiStatic]): AmdSmiStatic data model
62+ amdsmi_static_data (list [AmdSmiStatic]): AmdSmiStatic data model
6363 expected_max_power (int): expected max power
6464 """
65- incorrect_max_power_gpus : Dict [int , Union [int , str , float ]] = {}
65+ incorrect_max_power_gpus : dict [int , Union [int , str , float ]] = {}
6666 for gpu in amdsmi_static_data :
6767 if gpu .limit is None or gpu .limit .max_power is None :
6868 self ._log_event (
@@ -102,18 +102,18 @@ def check_expected_max_power(
102102
103103 def check_expected_driver_version (
104104 self ,
105- amdsmi_static_data : List [AmdSmiStatic ],
105+ amdsmi_static_data : list [AmdSmiStatic ],
106106 expected_driver_version : str ,
107107 ) -> None :
108108 """Check expectecd driver version
109109
110110 Args:
111- amdsmi_static_data (List [AmdSmiStatic]): AmdSmiStatic data model
111+ amdsmi_static_data (list [AmdSmiStatic]): AmdSmiStatic data model
112112 expected_driver_version (str): expected driver version
113113 """
114- bad_driver_gpus : List [int ] = []
114+ bad_driver_gpus : list [int ] = []
115115
116- versions_by_gpu : Dict [int , Optional [str ]] = {}
116+ versions_by_gpu : dict [int , Optional [str ]] = {}
117117 for gpu in amdsmi_static_data :
118118 ver : Optional [str ] = None
119119 if gpu .driver is not None :
@@ -136,7 +136,7 @@ def check_expected_driver_version(
136136
137137 def check_amdsmi_metric_pcie (
138138 self ,
139- amdsmi_metric_data : List [AmdSmiMetric ],
139+ amdsmi_metric_data : list [AmdSmiMetric ],
140140 l0_to_recovery_count_error_threshold : int ,
141141 l0_to_recovery_count_warning_threshold : int ,
142142 ):
@@ -146,7 +146,7 @@ def check_amdsmi_metric_pcie(
146146 Expected width/speeds should come from SKU info.
147147
148148 Args:
149- amdsmi_metric_data (List [AmdSmiMetric]): AmdSmiMetric data model
149+ amdsmi_metric_data (list [AmdSmiMetric]): AmdSmiMetric data model
150150 l0_to_recovery_count_error_threshold (int): Threshold for error events
151151 l0_to_recovery_count_warning_threshold (int): Threshold for warning events
152152 """
@@ -242,19 +242,19 @@ def check_amdsmi_metric_pcie(
242242 console_log = True ,
243243 )
244244
245- def check_amdsmi_metric_ecc_totals (self , amdsmi_metric_data : List [AmdSmiMetric ]):
245+ def check_amdsmi_metric_ecc_totals (self , amdsmi_metric_data : list [AmdSmiMetric ]):
246246 """Check ECC totals for all GPUs
247247
248248 Raises errors for uncorrectable errors, warnings for correctable and deferred.
249249
250250 Args:
251- amdsmi_metric_data (List [AmdSmiMetric]): AmdSmiMetric data model
251+ amdsmi_metric_data (list [AmdSmiMetric]): AmdSmiMetric data model
252252 """
253253 for metric in amdsmi_metric_data :
254254 ecc_totals = metric .ecc
255255 gpu = metric .gpu
256256
257- ecc_checks : List [tuple [EventPriority , Optional [int ], str ]] = [
257+ ecc_checks : list [tuple [EventPriority , Optional [int ], str ]] = [
258258 (
259259 EventPriority .WARNING ,
260260 ecc_totals .total_correctable_count ,
@@ -292,13 +292,13 @@ def check_amdsmi_metric_ecc_totals(self, amdsmi_metric_data: List[AmdSmiMetric])
292292 console_log = True ,
293293 )
294294
295- def check_amdsmi_metric_ecc (self , amdsmi_metric_data : List [AmdSmiMetric ]):
295+ def check_amdsmi_metric_ecc (self , amdsmi_metric_data : list [AmdSmiMetric ]):
296296 """Check ECC counts in all blocks for all GPUs
297297
298298 Raises errors for uncorrectable errors, warnings for correctable and deferred.
299299
300300 Args:
301- amdsmi_metric_data (List [AmdSmiMetric]): AmdSmiMetric data model
301+ amdsmi_metric_data (list [AmdSmiMetric]): AmdSmiMetric data model
302302 """
303303 for metric in amdsmi_metric_data :
304304 gpu = metric .gpu
@@ -352,15 +352,15 @@ def check_amdsmi_metric_ecc(self, amdsmi_metric_data: List[AmdSmiMetric]):
352352 )
353353
354354 def expected_gpu_processes (
355- self , processes_data : Optional [List [Processes ]], max_num_processes : int
355+ self , processes_data : Optional [list [Processes ]], max_num_processes : int
356356 ):
357357 """Check the number of GPU processes running
358358
359359 Args:
360- processes_data (Optional[List [Processes]]): list of processes per GPU
360+ processes_data (Optional[list [Processes]]): list of processes per GPU
361361 max_num_processes (int): max number of expected processes
362362 """
363- gpu_exceeds_num_processes : Dict [int , int ] = {}
363+ gpu_exceeds_num_processes : dict [int , int ] = {}
364364 if processes_data is None or len (processes_data ) == 0 :
365365 self ._log_event (
366366 category = EventCategory .PLATFORM ,
@@ -392,13 +392,13 @@ def expected_gpu_processes(
392392 console_log = True ,
393393 )
394394
395- def static_consistancy_check (self , amdsmi_static_data : List [AmdSmiStatic ]):
395+ def static_consistancy_check (self , amdsmi_static_data : list [AmdSmiStatic ]):
396396 """Check consistency of expected data
397397
398398 Args:
399- amdsmi_static_data (List [AmdSmiStatic]): AmdSmiStatic data model
399+ amdsmi_static_data (list [AmdSmiStatic]): AmdSmiStatic data model
400400 """
401- consistancy_data : Dict [str , Union [set [str ], set [int ]]] = {
401+ consistancy_data : dict [str , Union [set [str ], set [int ]]] = {
402402 "market_name" : {gpu .asic .market_name for gpu in amdsmi_static_data },
403403 "vendor_id" : {gpu .asic .vendor_id for gpu in amdsmi_static_data },
404404 "vendor_name" : {gpu .asic .vendor_name for gpu in amdsmi_static_data },
@@ -425,7 +425,7 @@ def static_consistancy_check(self, amdsmi_static_data: List[AmdSmiStatic]):
425425
426426 def check_static_data (
427427 self ,
428- amdsmi_static_data : List [AmdSmiStatic ],
428+ amdsmi_static_data : list [AmdSmiStatic ],
429429 vendor_id : Optional [str ],
430430 subvendor_id : Optional [str ],
431431 device_id : tuple [Optional [str ], Optional [str ]],
@@ -435,25 +435,25 @@ def check_static_data(
435435 """Check expected static data
436436
437437 Args:
438- amdsmi_static_data (List [AmdSmiStatic]): AmdSmiStatic data
438+ amdsmi_static_data (list [AmdSmiStatic]): AmdSmiStatic data
439439 vendor_id (Optional[str]): expected vendor_id
440440 subvendor_id (Optional[str]): expected subvendor_id
441441 device_id (tuple[Optional[str], Optional[str]]): expected device_id
442442 subsystem_id (tuple[Optional[str], Optional[str]]): expected subsystem_id
443443 sku_name (Optional[str]): expected sku_name
444444 """
445445
446- mismatches : List [tuple [int , str , str , str ]] = []
446+ mismatches : list [tuple [int , str , str , str ]] = []
447447
448- expected_data : Dict [str , Optional [str ]] = {
448+ expected_data : dict [str , Optional [str ]] = {
449449 "vendor_id" : vendor_id ,
450450 "subvendor_id" : subvendor_id ,
451451 "vendor_name" : "Advanced Micro Devices Inc" ,
452452 "market_name" : sku_name ,
453453 }
454454
455455 for gpu_data in amdsmi_static_data :
456- collected_data : Dict [str , str ] = {
456+ collected_data : dict [str , str ] = {
457457 "vendor_id" : gpu_data .asic .vendor_id ,
458458 "subvendor_id" : gpu_data .asic .subvendor_id ,
459459 "vendor_name" : gpu_data .asic .vendor_name ,
@@ -504,24 +504,24 @@ def check_static_data(
504504
505505 def _format_static_mismatch_payload (
506506 self ,
507- mismatches : List [tuple [int , str , str , str ]],
508- ) -> Dict [str , Any ]:
507+ mismatches : list [tuple [int , str , str , str ]],
508+ ) -> dict [str , Any ]:
509509 """Helper function for pretty printing mismatch in expected data
510510
511511 Args:
512- mismatches (List [tuple[int, str, str, str]]): mismatched data per GPU
512+ mismatches (list [tuple[int, str, str, str]]): mismatched data per GPU
513513
514514 Returns:
515- Dict [str, Any]: dict of mismatched data per GPU
515+ dict [str, Any]: dict of mismatched data per GPU
516516 """
517- per_gpu : Dict [int , List [ Dict [str , str ]]] = defaultdict (list )
517+ per_gpu : dict [int , list [ dict [str , str ]]] = defaultdict (list )
518518 field_set : set [str ] = set ()
519519
520520 for gpu , field , expected , actual in mismatches :
521521 field_set .add (field )
522522 per_gpu [gpu ].append ({"field" : field , "expected" : expected , "actual" : actual })
523523
524- per_gpu_list : List [ Dict [str , Any ]] = [
524+ per_gpu_list : list [ dict [str , Any ]] = [
525525 {"gpu" : gpu , "mismatches" : entries }
526526 for gpu , entries in sorted (per_gpu .items (), key = lambda kv : kv [0 ])
527527 ]
@@ -537,13 +537,13 @@ def _format_static_mismatch_payload(
537537
538538 def check_pldm_version (
539539 self ,
540- amdsmi_fw_data : Optional [List [Fw ]],
540+ amdsmi_fw_data : Optional [list [Fw ]],
541541 expected_pldm_version : Optional [str ],
542542 ):
543543 """Check expected pldm version
544544
545545 Args:
546- amdsmi_fw_data (Optional[List [Fw]]): data model
546+ amdsmi_fw_data (Optional[list [Fw]]): data model
547547 expected_pldm_version (Optional[str]): expected pldm version
548548 """
549549 PLDM_STRING = "PLDM_BUNDLE"
@@ -555,8 +555,8 @@ def check_pldm_version(
555555 data = {"amdsmi_fw_data" : amdsmi_fw_data },
556556 )
557557 return
558- mismatched_gpus : List [int ] = []
559- pldm_missing_gpus : List [int ] = []
558+ mismatched_gpus : list [int ] = []
559+ pldm_missing_gpus : list [int ] = []
560560 for fw_data in amdsmi_fw_data :
561561 gpu = fw_data .gpu
562562 if isinstance (fw_data .fw_list , str ):
@@ -641,14 +641,14 @@ def check_expected_memory_partition_mode(
641641
642642 def check_expected_xgmi_link_speed (
643643 self ,
644- xgmi_metric : Optional [List [XgmiMetrics ]],
645- expected_xgmi_speed : Optional [List [float ]] = None ,
644+ xgmi_metric : Optional [list [XgmiMetrics ]],
645+ expected_xgmi_speed : Optional [list [float ]] = None ,
646646 ):
647647 """Check the XGMI link speed for all GPUs
648648
649649 Args:
650- xgmi_metric (Optional[List [XgmiMetrics]]): XGMI metrics data
651- expected_xgmi_speed (Optional[List [float]]): List of expected XGMI speeds (GT/s)
650+ xgmi_metric (Optional[list [XgmiMetrics]]): XGMI metrics data
651+ expected_xgmi_speed (Optional[list [float]]): List of expected XGMI speeds (GT/s)
652652 """
653653 if xgmi_metric is None or len (xgmi_metric ) == 0 :
654654 self ._log_event (
0 commit comments