Skip to content

Commit

Permalink
even more debug prints
Browse files Browse the repository at this point in the history
  • Loading branch information
dhirving committed Aug 29, 2024
1 parent 823aa1b commit 1915ffa
Showing 1 changed file with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,6 @@ def query_execute(
assert False, "This line is unreachable."


def _retrieve_query_pages(ctx: _QueryContext, spec: ResultSpec) -> Iterator[QueryExecuteResultData]:
"""Execute the database query and and return pages of results."""
try:
print("before execute")
pages = ctx.driver.execute(spec, ctx.tree)
print("page1")
for page in pages:
yield convert_query_page(spec, page)
except ButlerUserError as e:
# If a user-facing error occurs, serialize it and send it to the
# client.
yield QueryErrorResultModel(error=serialize_butler_user_error(e))


# Instead of declaring this as a sync generator with 'def', it's async to
# give us more control over the lifetime of exit_stack. StreamingResponse
# ensures that this async generator is cancelled if the client
Expand Down Expand Up @@ -148,10 +134,26 @@ async def _stream_query_pages(
if message is None:
done = True
else:
yield message.model_dump_json()
message = message.model_dump_json()
print(f"{message=}")
yield message
yield "\n"


def _retrieve_query_pages(ctx: _QueryContext, spec: ResultSpec) -> Iterator[QueryExecuteResultData]:
"""Execute the database query and and return pages of results."""
try:
print("before execute")
pages = ctx.driver.execute(spec, ctx.tree)
print("page1")
for page in pages:
yield convert_query_page(spec, page)
except ButlerUserError as e:
# If a user-facing error occurs, serialize it and send it to the
# client.
yield QueryErrorResultModel(error=serialize_butler_user_error(e))


async def _fetch_next_with_keepalives(
iterator: AsyncIterator[QueryExecuteResultData],
) -> AsyncIterator[QueryExecuteResultData | None]:
Expand Down

0 comments on commit 1915ffa

Please sign in to comment.