[SWDEV-498649] Fix reset cli AttributeError (#2203)

* Fix SWDEV-498649: Handle missing attributes safely in set_gpu

---------

Co-authored-by: gabrpham <Gabriel.Pham@amd.com>
Co-authored-by: Maisam Arif <Maisam.Arif@amd.com>
Bu işleme şunda yer alıyor:
koushikbillakanti-amd
2026-01-28 22:39:50 -06:00
işlemeyi yapan: GitHub
ebeveyn 19725abbf4
işleme e9b143323a
2 değiştirilmiş dosya ile 20 ekleme ve 18 silme
+3 -1
Dosyayı Görüntüle
@@ -90,7 +90,9 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
### Resolved Issues ### Resolved Issues
- N/A - **Fixed `amd-smi set` commands showing an AttributeError when partition attributes are not present**.
- Resolved `AttributeError: 'Namespace' object has no attribute 'compute_partition'` error
- Now using safe `getattr()` access pattern for optional arguments in set_gpu function
## amd_smi_lib for ROCm 7.2.0 ## amd_smi_lib for ROCm 7.2.0
+17 -17
Dosyayı Görüntüle
@@ -4727,26 +4727,26 @@ class AMDSMICommands():
# Error if no subcommand args are passed # Error if no subcommand args are passed
if self.helpers.is_baremetal(): if self.helpers.is_baremetal():
if not any([args.fan is not None, if not any([getattr(args, 'fan', None) is not None,
args.perf_level, getattr(args, 'perf_level', None) is not None,
args.profile, getattr(args, 'profile', None) is not None,
args.compute_partition, getattr(args, 'compute_partition', None) is not None,
args.memory_partition, getattr(args, 'memory_partition', None) is not None,
args.perf_determinism is not None, getattr(args, 'perf_determinism', None) is not None,
args.power_cap is not None, getattr(args, 'power_cap', None) is not None,
args.soc_pstate is not None, getattr(args, 'soc_pstate', None) is not None,
args.xgmi_plpd is not None, getattr(args, 'xgmi_plpd', None) is not None,
args.clk_level is not None, getattr(args, 'clk_level', None) is not None,
args.clk_limit is not None, getattr(args, 'clk_limit', None) is not None,
args.ptl_status is not None, getattr(args, 'ptl_status', None) is not None,
args.ptl_format is not None, getattr(args, 'ptl_format', None) is not None,
args.process_isolation is not None]): getattr(args, 'process_isolation', None) is not None]):
command = " ".join(sys.argv[1:]) command = " ".join(sys.argv[1:])
raise AmdSmiRequiredCommandException(command, self.logger.format) raise AmdSmiRequiredCommandException(command, self.logger.format)
else: else:
if not any([args.power_cap is not None, if not any([getattr(args, 'power_cap', None) is not None,
args.clk_limit is not None, getattr(args, 'clk_limit', None) is not None,
args.process_isolation is not None]): getattr(args, 'process_isolation', None) is not None]):
command = " ".join(sys.argv[1:]) command = " ".join(sys.argv[1:])
raise AmdSmiRequiredCommandException(command, self.logger.format) raise AmdSmiRequiredCommandException(command, self.logger.format)