Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions grain/_src/python/dataset/transformations/process_prefetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ def _stop_prefetch(self):
return

self._prefetch_should_stop.set()
_clear_queue_and_maybe_unlink_shm(self._buffer)
self._clear_set_state_queue()

# Not joining here will cause the children to be zombie after they finish.
# Need to join or call active_children.
Expand All @@ -458,9 +460,9 @@ def _stop_prefetch(self):
# kill the child processes.
if self._prefetch_process.is_alive():
self._prefetch_process.kill()
else:
_clear_queue_and_maybe_unlink_shm(self._buffer)
self._prefetch_process = None
_clear_queue_and_maybe_unlink_shm(self._buffer)
self._clear_set_state_queue()
self._set_state_count = 0

def get_state(self) -> StateT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import os
import sys
import time
import types
from typing import TypeVar
from unittest import mock

Expand Down