Skip to content

Define blocking variants of everything in terms of non-blocking variant. #585

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 3 commits into
base: gh/zdevito/46/base
Choose a base branch
from

Conversation

zdevito
Copy link
Contributor

@zdevito zdevito commented Jul 19, 2025

Stack from ghstack (oldest at bottom):

This uses the PyPythonTask functionality developed in the last diff to delete all the _blocking variants of exposing tokio async work to Python.

The new approach is to define the entire thing in async and then wrap it in a future:

Future(async_impl, requires_loop=False).

If async_impl only awaits on (1) PythonTask objects, and (2) other coroutine functions, then it is correct to pass requires_loop=False, which keeps execution speed the same as the blocking version. Otherwise, pass requires_loop=True and the code will work correctly in both async and sync contexts.

Differential Revision: D78585722

This uses the PyPythonTask functionality developed in the last diff to delete all the _blocking variants of exposing tokio async work to Python.

The new approach is to define the entire thing in async and then wrap it in a future:

`Future(async_impl, requires_loop=False)`.

If async_impl only awaits on (1) PythonTask objects, and (2) other coroutine functions, then it is correct to pass `requires_loop=False`, which keeps execution speed the same as the blocking version. Otherwise, pass requires_loop=True and the code will work correctly in both async and sync contexts.

Differential Revision: [D78585722](https://our.internmc.facebook.com/intern/diff/D78585722/)

[ghstack-poisoned]
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 19, 2025
zdevito added a commit that referenced this pull request Jul 19, 2025
This uses the PyPythonTask functionality developed in the last diff to delete all the _blocking variants of exposing tokio async work to Python.

The new approach is to define the entire thing in async and then wrap it in a future:

`Future(async_impl, requires_loop=False)`.

If async_impl only awaits on (1) PythonTask objects, and (2) other coroutine functions, then it is correct to pass `requires_loop=False`, which keeps execution speed the same as the blocking version. Otherwise, pass requires_loop=True and the code will work correctly in both async and sync contexts.

Differential Revision: [D78585722](https://our.internmc.facebook.com/intern/diff/D78585722/)

ghstack-source-id: 297233471
Pull Request resolved: #585
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78585722

…cking variant."

This uses the PyPythonTask functionality developed in the last diff to delete all the _blocking variants of exposing tokio async work to Python.

The new approach is to define the entire thing in async and then wrap it in a future:

`Future(async_impl, requires_loop=False)`.

If async_impl only awaits on (1) PythonTask objects, and (2) other coroutine functions, then it is correct to pass `requires_loop=False`, which keeps execution speed the same as the blocking version. Otherwise, pass requires_loop=True and the code will work correctly in both async and sync contexts.

Differential Revision: [D78585722](https://our.internmc.facebook.com/intern/diff/D78585722/)

[ghstack-poisoned]
zdevito added a commit that referenced this pull request Jul 19, 2025
Pull Request resolved: #585

This uses the PyPythonTask functionality developed in the last diff to delete all the _blocking variants of exposing tokio async work to Python.

The new approach is to define the entire thing in async and then wrap it in a future:

`Future(async_impl, requires_loop=False)`.

If async_impl only awaits on (1) PythonTask objects, and (2) other coroutine functions, then it is correct to pass `requires_loop=False`, which keeps execution speed the same as the blocking version. Otherwise, pass requires_loop=True and the code will work correctly in both async and sync contexts.
ghstack-source-id: 297244019
@exported-using-ghexport

Differential Revision: [D78585722](https://our.internmc.facebook.com/intern/diff/D78585722/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78585722

…cking variant."

This uses the PyPythonTask functionality developed in the last diff to delete all the _blocking variants of exposing tokio async work to Python.

The new approach is to define the entire thing in async and then wrap it in a future:

`Future(async_impl, requires_loop=False)`.

If async_impl only awaits on (1) PythonTask objects, and (2) other coroutine functions, then it is correct to pass `requires_loop=False`, which keeps execution speed the same as the blocking version. Otherwise, pass requires_loop=True and the code will work correctly in both async and sync contexts.

Differential Revision: [D78585722](https://our.internmc.facebook.com/intern/diff/D78585722/)

[ghstack-poisoned]
zdevito added a commit that referenced this pull request Jul 19, 2025
Pull Request resolved: #585

This uses the PyPythonTask functionality developed in the last diff to delete all the _blocking variants of exposing tokio async work to Python.

The new approach is to define the entire thing in async and then wrap it in a future:

`Future(async_impl, requires_loop=False)`.

If async_impl only awaits on (1) PythonTask objects, and (2) other coroutine functions, then it is correct to pass `requires_loop=False`, which keeps execution speed the same as the blocking version. Otherwise, pass requires_loop=True and the code will work correctly in both async and sync contexts.
ghstack-source-id: 297251177
@exported-using-ghexport

Differential Revision: [D78585722](https://our.internmc.facebook.com/intern/diff/D78585722/)
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D78585722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants