Skip to content

Commit 6edcf5b

Browse files
slister1001Copilot
andauthored
[evaluation] fix race condition when saving red team results (#43107)
* fix race condition when saving red team results * Update sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluate/_utils.py Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent f2a9a34 commit 6edcf5b

File tree

1 file changed

+5
-1
lines changed
  • sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluate

1 file changed

+5
-1
lines changed

sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_evaluate/_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,11 @@ def _write_output(path: Union[str, os.PathLike], data_dict: Any) -> None:
330330
json.dump(data_dict, f, ensure_ascii=False)
331331

332332
# Use tqdm.write to print message without interfering with any current progress bar
333-
tqdm.write(f'Evaluation results saved to "{p.resolve()}".\n')
333+
# Fall back to regular print if tqdm.write fails (e.g., when progress bar is closed)
334+
try:
335+
tqdm.write(f'Evaluation results saved to "{p.resolve()}".\n')
336+
except Exception:
337+
print(f'Evaluation results saved to "{p.resolve()}".\n')
334338

335339

336340
def _apply_column_mapping(

0 commit comments

Comments
 (0)