Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Xue <andewzxue@gmail.com>
  • Loading branch information
Zandew committed Nov 8, 2023
1 parent b2fab9d commit dd4f333
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 6 additions & 7 deletions python/ray/data/_internal/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,12 @@ def _run_iter_update_loop():
self._iter_update_thread.start()

def clear_stats_actor_iter_metrics(self, tags: Dict[str, str]):
if self._iter_update_thread is not None:
# Stop background update thread.
self._collect_iter_stats = False
with self._iter_update_condition:
self._iter_update_condition.notify()
self._iter_update_thread.join()
self._iter_update_thread = None
# Stop background update thread.
self._collect_iter_stats = False
with self._iter_update_condition:
self._iter_update_condition.notify()
self._iter_update_thread.join()
self._iter_update_thread = None

# Clear metrics from _StatsActor.
global _stats_actor
Expand Down
4 changes: 3 additions & 1 deletion python/ray/data/tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ def patch_update_stats_actor():
def patch_update_stats_actor_iter():
with patch(
"ray.data._internal.stats.StatsActorManager.update_stats_actor_iter_metrics"
) as update_fn:
) as update_fn, patch(
"ray.data._internal.stats.StatsActorManager.clear_stats_actor_iter_metrics"
):
yield update_fn


Expand Down

0 comments on commit dd4f333

Please sign in to comment.