Fixed log handling and exceptions

Updated exceptions
	Added driver load exception
	Fixed logging override by removing previous log handlers
	Updated debug output to use gpu_id vs C-pointer
	Removed AmdSmiRetcode class in favor of using the wrapper
directly
	Added traceback limits for clean errors (Not in debug)

Change-Id: Ia02bb842b8f60d9ab4b68b7f8b1afda30b1c021c
Signed-off-by: Maisam Arif <maisarif@amd.com>
Este commit está contenido en:
Maisam Arif
2023-09-24 16:12:30 -05:00
padre db3e119f7d
commit 9281bfbbfa
Se han modificado 8 ficheros con 188 adiciones y 157 borrados
+16 -8
Ver fichero
@@ -66,14 +66,22 @@ if __name__ == "__main__":
amd_smi_commands.logger.format = amd_smi_commands.logger.LoggerFormat.csv.value
if args.file:
amd_smi_commands.logger.destination = args.file
if args.loglevel:
logging_dict = {'DEBUG' : logging.DEBUG,
'INFO' : logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL}
# Enable debug logs on amdsmi library ie. RSMI_LOGGING = 1 in environment or otherwise
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging_dict[args.loglevel])
# Remove previous log handlers
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
logging_dict = {'DEBUG' : logging.DEBUG,
'INFO' : logging.INFO,
'WARNING': logging.WARNING,
'ERROR': logging.ERROR,
'CRITICAL': logging.CRITICAL}
# To enable debug logs on rocm-smi library set RSMI_LOGGING = 1 in environment
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging_dict[args.loglevel])
# Disable traceback for non-debug log levels
if args.loglevel != "DEBUG":
sys.tracebacklimit = -1
# Execute subcommands
args.func(args)