(code_content: str, data_directory: Path, result_queue, timeout_seconds: int)
| 330 | |
| 331 | |
| 332 | def execute_code_in_process(code_content: str, data_directory: Path, result_queue, timeout_seconds: int): |
| 333 | |
| 334 | try: |
| 335 | import pandas as pd |
| 336 | import numpy as np |
| 337 | import matplotlib |
| 338 | import matplotlib.pyplot as plt |
| 339 | import os |
| 340 | |
| 341 | matplotlib.use('Agg') |
| 342 | |
| 343 | exec_globals = { |
| 344 | '__name__': '__main__', |
| 345 | 'pd': pd, |
| 346 | 'np': np, |
| 347 | 'plt': plt, |
| 348 | 'matplotlib': matplotlib, |
| 349 | 'os': os, |
| 350 | } |
| 351 | |
| 352 | try: |
| 353 | import seaborn as sns |
| 354 | exec_globals['sns'] = sns |
| 355 | except ImportError: |
| 356 | pass |
| 357 | |
| 358 | exec(code_content, exec_globals) |
| 359 | result_queue.put(('success', 'Code execution completed')) |
| 360 | |
| 361 | except Exception as e: |
| 362 | import traceback |
| 363 | full_traceback = traceback.format_exc() |
| 364 | result_queue.put(('error', f"Code execution failed: {str(e)}\n\nFull traceback:\n{full_traceback}")) |
| 365 | |
| 366 | |
| 367 | def execute_code_with_timeout(code_content: str, data_directory: Path, timeout_seconds: int = 120): |
nothing calls this directly
no outgoing calls
no test coverage detected