Skip to content

Commit a74ccf9

Browse files
implementation done, successfully added auto pulling mechanism (#193)
Thank you for the PR. LGTM
1 parent 75a70a8 commit a74ccf9

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

mlc/script_action.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,25 @@ def call_script_module_function(self, function_name, run_args):
219219
# Import script submodule
220220
script_path = self.find_target_folder("script")
221221
if not script_path:
222-
return {'return': 1, 'error': f"""Script automation not found. Have you done "mlc pull repo mlcommons@mlperf-automations --branch=dev"?"""}
222+
logger.warning("Script automation not found. Automatically pulling mlcommons@mlperf-automations repository...")
223+
224+
# Use the access method to pull the required repository
225+
result = self.access({
226+
"automation": "repo",
227+
"action": "pull",
228+
"repo": "mlcommons@mlperf-automations",
229+
"branch": "dev"
230+
})
231+
232+
if result['return'] == 0:
233+
# Try to find the script path again after pulling
234+
script_path = self.find_target_folder("script")
235+
if not script_path:
236+
return {'return': 1, 'error': f"""Script automation still not found after pulling mlcommons@mlperf-automations --branch=dev."""}
237+
else:
238+
# If pull failed, return the original error with additional info
239+
logger.error(f"Failed to pull mlcommons@mlperf-automations repository: {result.get('error', 'Unknown error')}")
240+
return {'return': 1, 'error': f"""Script automation not found and failed to automatically pull mlcommons@mlperf-automations --branch=dev. Please run "mlc pull repo mlcommons@mlperf-automations --branch=dev" manually: {result.get('error', 'Unknown error')}"""}
223241

224242
module_path = os.path.join(script_path, "module.py")
225243
module = self.dynamic_import_module(module_path)

0 commit comments

Comments
 (0)