RuntimeHandle

class RuntimeHandle(*args, **kwargs)[source]

Bases: Protocol

A structural type capturing BQSKit Runtime capabilities.

A compiler pass designer can effortlessly parallelize certain aspects of compilation using the submit() and map() methods. These both will return RuntimeFuture objects, which can be awaited on using the standard python await keyword. This can also be used to cancel tasks and wait on specific events.

This should never be constructed directly and only accessed through the get_runtime() function, since this is a structural type definition and does not contain any implementation.

__init__(*args, **kwargs)

Methods

cancel(future)

Cancel all tasks associated with future.

get_cache()

Retrieve worker's local cache.

map(fn, *args, **kwargs)

Map fn over the input arguments distributed across the runtime.

next(future)

Wait for and return the next batch of results from a map task.

submit(fn, *args, **kwargs)

Submit a fn to the runtime.