Skip to content

Starknet updates and fixes #57

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions sqa/starknet/writer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


async def rpc_ingest(rpc: RpcClient, first_block: int, last_block: int | None = None) -> AsyncIterator[list[WriterBlock]]:
LOG.info(f'ingesting data via RPC')
LOG.info('Ingesting data via RPC')

# TODO: ensure starknet finality for finality_confirmation arg
ingest = IngestStarknet(
Expand Down Expand Up @@ -142,7 +142,7 @@ def _ingest(self) -> Iterable[list[WriterBlock]]: # type: ignore # NOTE: incop

assert rpc, 'no endpoints were specified'

return _to_sync_gen(lambda: rpc_ingest(rpc, args.first_block, args.last_block))
return _to_sync_gen(lambda: rpc_ingest(rpc, self._sink().get_next_block(), args.last_block))

def create_writer(self) -> Writer:
return ParquetWriter()
Expand Down
4 changes: 2 additions & 2 deletions sqa/writer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ def flush():
self._report()
last_report = current_time

if self._writer.buffered_bytes() > 0 and last_block == write_range[1]:
flush()
# NOTE: In case no chunks were made we still need to save data we received
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason behind abandoning the check above?

Although I don't remember why it exists, I know, that we don't want to write half sized chunk unless it is the last one in the specified range.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since bytesize counts as sum of chunks for all tables, if no chuncks were created this check leads to data loss for smaller data volumes

flush()

self._writer.end()

Expand Down