Skip to content

Commit

Permalink
Adds a note mentioning that DatasetIterator is not thread-safe.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 698752774
  • Loading branch information
jimlinntu authored and copybara-github committed Nov 22, 2024
1 parent 74d043d commit 446bbcf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion grain/_src/python/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,11 @@ def __iter__(self) -> DatasetIterator[T]:


class DatasetIterator(Iterator[T], abc.ABC):
"""`IterDataset` iterator."""
"""`IterDataset` iterator.
NOTE: The methods are assumed to be thread-unsafe. Please ensure only a single
thread can access a `DatasetIterator` instance.
"""

# Whether this transformation mutates parent elements. This does not affect
# the transformation itself, only used for information purposes in statistics.
Expand Down

0 comments on commit 446bbcf

Please sign in to comment.