-
tensorstore.Future[T](future: FutureLike, *, loop: asyncio.AbstractEventLoop | None =
None) Converts a
FutureLikeobject to aFuture.Example
>>> await ts.Future(3) 3>>> x = ts.Future(3) >>> assert x is ts.Future(x)>>> async def get_value(): ... return 42 >>> x = ts.Future(get_value()) >>> x.done() False >>> await x >>> x.result() 42- Parameters:¶
- future: FutureLike¶
Specifies the immediate or asynchronous result.
- loop: asyncio.AbstractEventLoop | None =
None¶ Event loop on which to run
futureif it is a coroutine. If not specified (orNoneis specified), defaults to the loop returned byasyncio.get_running_loop. Ifloopis not specified and there is no running event loop, it is an error forfutureto be a coroutine.
- Returns:¶
Warning
If
futureis a coroutine, a blocking call toFuture.resultorFuture.exceptionin the thread running the associated event loop may lead to deadlock. Blocking calls should be avoided when using an event loop.