Skip to content

Commit

Permalink
alter close behavior to only dump_state if the bar is not already closed
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Owen <[email protected]>
  • Loading branch information
omatthew98 committed Aug 1, 2024
1 parent 65fde27 commit e88bd35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/ray/experimental/tqdm_ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def update(self, n=1):

def close(self):
"""Implements tqdm.tqdm.close."""
self._closed = True
# Don't bother if ray is shutdown (in __del__ hook).
if ray is not None:
if ray is not None and not self._closed:
self._dump_state(force_flush=True)
self._closed = True

def refresh(self):
"""Implements tqdm.tqdm.refresh."""
Expand Down

0 comments on commit e88bd35

Please sign in to comment.