bqskit
bqskit copied to clipboard
“Lazy Map” capability for the BQSKit runtime
I’d like the ability to perform a “lazy map”, meaning to have a RuntimeFuture
to which I can submit more tasks. Here’s an example scenario where this would be useful:
- I start an asynchronous task A
- I perform some other code
- I start an asynchronous task B
- I wait for a result from either A or B (whichever finishes first)
- I cancel the other task (or all such other tasks if you expand this pattern beyond 2 tasks).
I imagine the code looking something like this:
lazy_map = get_runtime().lazy_map()
lazy_map.submit(A)
# other code
lazy_map.submit(B)
result = await lazy_map
lazy_map.cancel()
Another way to do this would be a way to await
a list of futures