SWDEV-469004 - Append additonal path to system path
amd-smi is installed in /opt/rocm-ver/bin, but not as a soft link in wheel package For amd-smi to work from bin directory, it need the extra path to find the dependent python scripts in /opt/rocm-ver/libexec/amd_smi Change-Id: I4ff63a8f55949aaac51d85eae849ecc890f4c694
Этот коммит содержится в:
коммит произвёл
Maisam Arif
родитель
92a4093256
Коммит
7591eec971
@@ -24,19 +24,43 @@
|
||||
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
|
||||
try:
|
||||
import argcomplete
|
||||
except ImportError:
|
||||
logging.debug("argcomplete module not found. Autocomplete will not work.")
|
||||
|
||||
from amdsmi_commands import AMDSMICommands
|
||||
from amdsmi_parser import AMDSMIParser
|
||||
from amdsmi_logger import AMDSMILogger
|
||||
import amdsmi_cli_exceptions
|
||||
from amdsmi import amdsmi_interface
|
||||
from amdsmi import amdsmi_exception
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
# only used for type checking
|
||||
# pyright trips up and cannot find amdsmi scripts without it
|
||||
if TYPE_CHECKING:
|
||||
from amdsmi_commands import AMDSMICommands
|
||||
from amdsmi_parser import AMDSMIParser
|
||||
from amdsmi_logger import AMDSMILogger
|
||||
import amdsmi_cli_exceptions
|
||||
from amdsmi import amdsmi_interface
|
||||
from amdsmi import amdsmi_exception
|
||||
try:
|
||||
from amdsmi_commands import AMDSMICommands
|
||||
from amdsmi_parser import AMDSMIParser
|
||||
from amdsmi_logger import AMDSMILogger
|
||||
import amdsmi_cli_exceptions
|
||||
from amdsmi import amdsmi_interface
|
||||
from amdsmi import amdsmi_exception
|
||||
except ImportError:
|
||||
current_path = os.path.dirname(os.path.abspath(__file__))
|
||||
additional_path = f"{current_path}/../libexec/amdsmi_cli"
|
||||
sys.path.append(additional_path)
|
||||
try:
|
||||
from amdsmi_commands import AMDSMICommands
|
||||
from amdsmi_parser import AMDSMIParser
|
||||
from amdsmi_logger import AMDSMILogger
|
||||
import amdsmi_cli_exceptions
|
||||
from amdsmi import amdsmi_interface
|
||||
from amdsmi import amdsmi_exception
|
||||
except ImportError:
|
||||
print(f"Still couldn't import 'amdsmi related scripts'. Make sure it's installed in {additional_path}")
|
||||
sys.exit(1)
|
||||
|
||||
def _print_error(e, destination):
|
||||
if destination in ['stdout', 'json', 'csv']:
|
||||
|
||||
Ссылка в новой задаче
Block a user