(code_content: str, data_directory: Path, result_queue, timeout_seconds: int)
| 338 | |
| 339 | |
| 340 | def execute_code_in_process(code_content: str, data_directory: Path, result_queue, timeout_seconds: int): |
| 341 | |
| 342 | try: |
| 343 | import pandas as pd |
| 344 | import numpy as np |
| 345 | import matplotlib |
| 346 | import matplotlib.pyplot as plt |
| 347 | import os |
| 348 | |
| 349 | matplotlib.use('Agg') |
| 350 | |
| 351 | exec_globals = { |
| 352 | '__name__': '__main__', |
| 353 | 'pd': pd, |
| 354 | 'np': np, |
| 355 | 'plt': plt, |
| 356 | 'matplotlib': matplotlib, |
| 357 | 'os': os, |
| 358 | } |
| 359 | |
| 360 | try: |
| 361 | import seaborn as sns |
| 362 | exec_globals['sns'] = sns |
| 363 | except ImportError: |
| 364 | pass |
| 365 | |
| 366 | exec(code_content, exec_globals) |
| 367 | result_queue.put(('success', 'Code execution completed')) |
| 368 | |
| 369 | except Exception as e: |
| 370 | import traceback |
| 371 | full_traceback = traceback.format_exc() |
| 372 | result_queue.put(('error', f"Code execution failed: {str(e)}\n\nFull traceback:\n{full_traceback}")) |
| 373 | |
| 374 | |
| 375 | 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