Update the progress bar and write the result to the output file.
(
result: EvalOutput,
pbar: tqdm,
output_fp: TextIO,
)
| 323 | time.sleep(5) |
| 324 | |
| 325 | def update_progress( |
| 326 | result: EvalOutput, |
| 327 | pbar: tqdm, |
| 328 | output_fp: TextIO, |
| 329 | ): |
| 330 | """Update the progress bar and write the result to the output file.""" |
| 331 | logger = LoggerManager.get_logger() |
| 332 | pbar.update(1) |
| 333 | pbar.set_description(f'Instance {result.instance_id}') |
| 334 | pbar.set_postfix_str(f'Test Result: {str(result.test_result)[:300]}...') |
| 335 | logger.info( |
| 336 | f'Finished evaluation for instance {result.instance_id}: {str(result.test_result)[:300]}...\n' |
| 337 | ) |
| 338 | output_fp.write(json.dumps(result.model_dump()) + '\n') |
| 339 | output_fp.flush() |
| 340 | |
| 341 | def cleanup(): |
| 342 | print('Cleaning up child processes...') |
no test coverage detected