From 6536a9d969dd43ff99b50c03a549bb2d5e5c94a7 Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Wed, 21 Feb 2024 06:46:02 -0600 Subject: [PATCH] Unified human readable output tabbing with Host Signed-off-by: Maisam Arif Change-Id: Ie8ebe783e0e2cd445a0b29431c11302a0675a010 [ROCm/amdsmi commit: 180f8937911f750365ac4be310c57ec5322193a7] --- projects/amdsmi/amdsmi_cli/amdsmi_logger.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_logger.py b/projects/amdsmi/amdsmi_cli/amdsmi_logger.py index 52286918b8..0b65cc250d 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_logger.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_logger.py @@ -126,6 +126,18 @@ class AMDSMILogger(): # First Capitalize all keys in the json object capitalized_json = self._capitalize_keys(json_object) + + # Increase tabbing for device arguments by pulling them out of the main dictionary and assiging them to an empty string + tabbed_dictionary = {} + for key, value in capitalized_json.items(): + if key not in ["GPU", "CPU", "CORE"]: + tabbed_dictionary[key] = value + + for key, value in tabbed_dictionary.items(): + del capitalized_json[key] + + capitalized_json["AMDSMI_SPACING_REMOVAL"] = tabbed_dictionary + json_string = json.dumps(capitalized_json, indent=4) yaml_data = yaml.safe_load(json_string) yaml_output = yaml.dump(yaml_data, sort_keys=False, allow_unicode=True)