From 5f206aaf27c19152bbbc6081deebf73444b52441 Mon Sep 17 00:00:00 2001 From: mlcommons-bot Date: Fri, 29 Nov 2024 07:00:53 +0000 Subject: [PATCH] [Automated Commit] Format Codebase --- script/get-spec-ptd/customize.py | 1 - script/run-mlperf-power-server/customize.py | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/script/get-spec-ptd/customize.py b/script/get-spec-ptd/customize.py index 9db87351ce..6e88200dd5 100644 --- a/script/get-spec-ptd/customize.py +++ b/script/get-spec-ptd/customize.py @@ -32,7 +32,6 @@ def postprocess(i): # Add execute permissions for the user os.chmod(file_path, current_permissions | stat.S_IXUSR) - env['CM_SPEC_PTD_PATH'] = env['CM_MLPERF_PTD_PATH'] return {'return': 0} diff --git a/script/run-mlperf-power-server/customize.py b/script/run-mlperf-power-server/customize.py index f6fd1d4d8f..067c19d28c 100644 --- a/script/run-mlperf-power-server/customize.py +++ b/script/run-mlperf-power-server/customize.py @@ -9,7 +9,6 @@ def preprocess(i): os_info = i['os_info'] env = i['env'] - # Initialize ConfigParser config = configparser.ConfigParser() @@ -22,7 +21,8 @@ def preprocess(i): # Read the configuration file with error handling if not os.path.exists(server_config_file): - raise FileNotFoundError(f"Server config file not found: {server_config_file}") + raise FileNotFoundError( + f"Server config file not found: {server_config_file}") config.read(server_config_file) # Update the server section @@ -34,7 +34,10 @@ def preprocess(i): # Define number of analyzers and network port start num_analyzers = int(env.get('CM_MLPERF_POWER_NUM_ANALYZERS', 1)) - network_port_start = int(env.get('CM_MLPERF_POWER_NETWORK_PORT_START', 8888)) + network_port_start = int( + env.get( + 'CM_MLPERF_POWER_NETWORK_PORT_START', + 8888)) # Ensure 'ptd' section exists if 'ptd' in config: @@ -50,10 +53,14 @@ def preprocess(i): config.add_section(analyzer_section) # Add the analyzer subsection as keys under the 'ptd' section - config[f'{analyzer_section}']['interfaceFlag'] = str(env.get('CM_MLPERF_POWER_INTERFACE_FLAG', '')) - config[f'{analyzer_section}']['deviceType'] = str(env.get('CM_MLPERF_POWER_DEVICE_TYPE', '')) - config[f'{analyzer_section}']['devicePort'] = str(env.get('CM_MLPERF_POWER_DEVICE_PORT', '')) - config[f'{analyzer_section}']['networkPort'] = str(network_port_start + aid - 1) + config[f'{analyzer_section}']['interfaceFlag'] = str( + env.get('CM_MLPERF_POWER_INTERFACE_FLAG', '')) + config[f'{analyzer_section}']['deviceType'] = str( + env.get('CM_MLPERF_POWER_DEVICE_TYPE', '')) + config[f'{analyzer_section}']['devicePort'] = str( + env.get('CM_MLPERF_POWER_DEVICE_PORT', '')) + config[f'{analyzer_section}']['networkPort'] = str( + network_port_start + aid - 1) with open('power-server.conf', 'w') as configfile: config.write(configfile)