(code_content: str, data_directory: Path, result_queue, timeout_seconds: int)
| 370 | |
| 371 | |
| 372 | def execute_code_in_process(code_content: str, data_directory: Path, result_queue, timeout_seconds: int): |
| 373 | |
| 374 | try: |
| 375 | import pandas as pd |
| 376 | import numpy as np |
| 377 | import matplotlib |
| 378 | import matplotlib.pyplot as plt |
| 379 | import os |
| 380 | |
| 381 | matplotlib.use('Agg') |
| 382 | |
| 383 | exec_globals = { |
| 384 | '__name__': '__main__', |
| 385 | 'pd': pd, |
| 386 | 'np': np, |
| 387 | 'plt': plt, |
| 388 | 'matplotlib': matplotlib, |
| 389 | 'os': os, |
| 390 | } |
| 391 | |
| 392 | try: |
| 393 | import seaborn as sns |
| 394 | exec_globals['sns'] = sns |
| 395 | except ImportError: |
| 396 | pass |
| 397 | |
| 398 | exec(code_content, exec_globals) |
| 399 | result_queue.put(('success', 'Code execution completed')) |
| 400 | |
| 401 | except Exception as e: |
| 402 | import traceback |
| 403 | full_traceback = traceback.format_exc() |
| 404 | result_queue.put(('error', f"Code execution failed: {str(e)}\n\nFull traceback:\n{full_traceback}")) |
| 405 | |
| 406 | |
| 407 | 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