caikit.core.toolkit.sync_to_async
This module holds utilities for wrapping synchronous functionality into async wrapper functions
Functions
|
Wrap blocking iterable into an asynchronous one |
Module Contents
- caikit.core.toolkit.sync_to_async.async_wrap_iter(it: Iterable, pool: concurrent.futures.ThreadPoolExecutor | None = None) AsyncGenerator[source]
Wrap blocking iterable into an asynchronous one
CITE: https://stackoverflow.com/a/62297994
This function manages a single thread for the iteration that shuttles the synchronous outputs back to the async generator using a queue