(self)
| 53 | pass |
| 54 | |
| 55 | def run(self): |
| 56 | if self.use_process: |
| 57 | manager = multiprocessing.Manager() |
| 58 | return_dict = manager.dict() |
| 59 | process = multiprocessing.Process( |
| 60 | target=self.execute_code, args=(return_dict,)) |
| 61 | process.start() |
| 62 | process.join(timeout=self.timeout) |
| 63 | process.terminate() |
| 64 | else: |
| 65 | return_dict = {} |
| 66 | thread = threading.Thread( |
| 67 | target=self.execute_code, args=(return_dict,)) |
| 68 | thread.start() |
| 69 | thread.join(timeout=self.timeout) |
| 70 | if thread.is_alive(): |
| 71 | thread.join() # Ensures the thread is terminated before continuing |
| 72 | print('time out!') |
| 73 | self.error = 'Execution timed out' |
| 74 | |
| 75 | if 'result' in return_dict: |
| 76 | return return_dict['result'] |
| 77 | else: |
| 78 | return '' |
| 79 | |
| 80 | |
| 81 | def read_jsonl(path: str): |
no test coverage detected