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
+3 -2
Ver fichero
@@ -37,6 +37,8 @@ from amdsmi import amdsmi_exception
# Using basic python logging for user errors and development
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.ERROR) # User level logging
# This traceback limit only affects this file, once the code hit's the cli portion it get's reset to the user's preference
sys.tracebacklimit = -1 # Disable traceback for user errors
# On initial import set initialized variable
AMDSMI_INITIALIZED = False
@@ -66,8 +68,7 @@ def init_amdsmi(flag=amdsmi_interface.AmdSmiInitFlags.INIT_AMD_GPUS):
amdsmi_interface.amdsmi_init(flag)
except (amdsmi_interface.AmdSmiLibraryException, amdsmi_interface.AmdSmiParameterException) as err:
raise err
logging.info('AMDSMI initialized successfully') # without errors really
logging.debug('AMDSMI initialized successfully')
else:
logging.error('Driver not initialized (amdgpu not found in modules)')
exit(-1)