Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to read chunk id in stream object. #2015

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 6 additions & 0 deletions python/vineyard/io/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
from vineyard._C import ObjectID
from vineyard._C import ObjectMeta
from vineyard._C import StreamDrainedException
from vineyard.core.driver import registerize

Check warning on line 31 in python/vineyard/io/stream.py

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

Unknown word (registerize)
from vineyard.core.resolver import resolver_context

logger = logging.getLogger('vineyard')


@registerize

Check warning on line 37 in python/vineyard/io/stream.py

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

Unknown word (registerize)
def read(
path,
*args,
Expand Down Expand Up @@ -114,7 +114,7 @@
raise ValueError("No IO driver registered for %s" % path)


@registerize

Check warning on line 117 in python/vineyard/io/stream.py

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

Unknown word (registerize)
def write(
path, stream, *args, handlers=None, chunk_hook: Optional[Callable] = None, **kwargs
):
Expand Down Expand Up @@ -264,6 +264,12 @@
self._resolver = resolver
self._client.open_stream(stream, 'r')

def next_chunk_id(self) -> ObjectID:
try:
return self._client.next_chunk_id(self._stream)
except StreamDrainedException as e:
raise StopIteration('No more chunks') from e

def next(self) -> object:
try:
chunk = self._client.next_chunk(self._stream)
Expand Down Expand Up @@ -418,7 +424,7 @@
return self._meta

@property
def isglobal(self):

Check warning on line 427 in python/vineyard/io/stream.py

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

Unknown word (isglobal)
return self._global

@property
Expand Down
Loading