Skip to content

Commit

Permalink
Eval runner to wait for background IO before finish.
Browse files Browse the repository at this point in the history
Before this CL, `lf.eval.v2.Experiment.run` can finish before background IO completes, which could lead to saved file corruption due to premature process exit.

PiperOrigin-RevId: 702756055
  • Loading branch information
daiyip authored and langfun authors committed Dec 4, 2024
1 parent 1220ac6 commit fca081b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions langfun/core/eval/v2/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ def run(self) -> None:
if cache is not None:
self.background_run(cache.save)

# Wait for the background tasks to finish.
self._io_pool.shutdown(wait=True)

@abc.abstractmethod
def _run(self, evaluations: list[Evaluation]) -> None:
"""Runs multiple evaluations."""
Expand Down

0 comments on commit fca081b

Please sign in to comment.