MCPcopy Create free account
hub / github.com/bartblockmans/benchmark_mpj / _run_python_script

Method _run_python_script

benchmark.py:350–370  ·  view source on GitHub ↗

Run the Python script and measure execution time.

(self)

Source from the content-addressed store, hash-verified

348 return mode_descriptions.get(self.benchmark_mode, 'Unknown mode')
349
350 def _run_python_script(self):
351 """Run the Python script and measure execution time."""
352 start_time = time.time()
353
354 try:
355 result = subprocess.run([sys.executable, self.scripts['Python']],
356 capture_output=True, text=True, timeout=SCRIPT_TIMEOUT)
357 end_time = time.time()
358
359 if result.returncode == 0:
360 # Check if there are any error messages in stderr
361 if result.stderr and result.stderr.strip():
362 return end_time - start_time, False, f"Script completed but with errors: {result.stderr}"
363 else:
364 return end_time - start_time, True, result.stdout
365 else:
366 return end_time - start_time, False, result.stderr
367 except subprocess.TimeoutExpired:
368 return SCRIPT_TIMEOUT, False, f"Script timed out after {SCRIPT_TIMEOUT//60} minutes"
369 except Exception as e:
370 return 0, False, str(e)
371
372 def _run_julia_script(self):
373 """Run the Julia script and measure execution time."""

Callers 1

_run_implementationMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected