Skip to content
Merged
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
13 changes: 6 additions & 7 deletions src/spdl/pipeline/_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,9 @@ def load(path):
.build(num_threads=10)
)

with pipeline.auto_stop():
for item in pipeline.get_iterator(timeout=30):
# do something with the decoded image
...
for item in pipeline.get_iterator(timeout=30):
# do something with the decoded image
...

A ``Pipeline`` cleans up its background thread and worker processes
automatically, so a forgotten pipeline will not hang the process at exit: it
Expand All @@ -532,11 +531,11 @@ def load(path):

.. versionchanged:: 0.4.0

**[Experimental]** Calling :py:meth:`start` and :py:meth:`stop` is now
optional. When iterating a pipeline that has not been explicitly started,
Calling :py:meth:`start` and :py:meth:`stop` is now optional.
When iterating a pipeline that has not been explicitly started,
the background thread is started automatically on the first item request.
When the ``Pipeline`` object is garbage collected, the background thread
is stopped automatically via :py:func:`weakref.finalize`.
is stopped automatically via :py:class:`weakref.finalize`.
Explicit :py:meth:`start` / :py:meth:`stop` and the :py:meth:`auto_stop`
context manager continue to work as before.

Expand Down
Loading