Skip to content

refactor(bigframes): make executor internals async#17093

Merged
TrevorBergeron merged 10 commits into
mainfrom
tbergeron_async_exec
May 14, 2026
Merged

refactor(bigframes): make executor internals async#17093
TrevorBergeron merged 10 commits into
mainfrom
tbergeron_async_exec

Conversation

@TrevorBergeron
Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the execution engine to support asynchronous operations using asyncio. It introduces a background event loop and converts core executor methods to async, while wrapping blocking I/O calls with asyncio.to_thread. Review feedback identifies a missing threading import, a regression where the removed prepare_plan method is still called in _is_trivially_executable, and suggestions to add docstrings to the newly refactored planning methods.

Comment thread packages/bigframes/bigframes/session/bq_caching_executor.py
Comment thread packages/bigframes/bigframes/session/bq_caching_executor.py
Comment thread packages/bigframes/bigframes/session/bq_caching_executor.py
Comment thread packages/bigframes/bigframes/session/bq_caching_executor.py Outdated
@TrevorBergeron TrevorBergeron requested a review from tswast May 14, 2026 01:37
@TrevorBergeron TrevorBergeron marked this pull request as ready for review May 14, 2026 19:34
@TrevorBergeron TrevorBergeron requested review from a team as code owners May 14, 2026 19:34
subscribers_snapshot = list(self._subscribers)
loop = asyncio.get_running_loop()
tasks = [
loop.run_in_executor(self._executor, subscriber, event)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This may eventually cause trouble. I've experienced having the main thread be the only one that can apply GUI updates in some frameworks, but I suppose we can address that (e.g. by having an option or something to run on the same thread as the original), but should be fine for the current use case of printing to stdout/stderr.

Copy link
Copy Markdown
Contributor

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Thanks!


# If the user has labels they wish to set, make sure we set those first so
# they are preserved.
for key, value in bigframes.options.compute.extra_query_labels.items():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did we move this feature somewhere else?

Edit: Yes. ExecutionSpec now reads this config.

@TrevorBergeron TrevorBergeron merged commit daaed67 into main May 14, 2026
30 of 31 checks passed
@TrevorBergeron TrevorBergeron deleted the tbergeron_async_exec branch May 14, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants