Results API¶
qm.results.base_streaming_result_fetcher.BaseStreamingResultFetcher
¶
job_id: str
property
¶
The job id this result came from
name: str
property
¶
The name of result this handle is connected to
stream_metadata: Optional[StreamMetadata]
property
¶
Provides the StreamMetadata of this stream.
Metadata currently includes the values and shapes of the automatically identified loops in the program.
count_so_far
¶
also len(handle)
RETURNS | DESCRIPTION |
---|---|
int
|
The number of values this result has so far |
fetch
¶
Fetch a single result from the current result stream saved in server memory. The result stream is populated by the save().
PARAMETER | DESCRIPTION |
---|---|
item |
ignored
TYPE:
|
check_for_errors |
If true, the function would also check whether run-time errors happened during the program execution and would write to the logger an error message.
TYPE:
|
flat_struct |
results will have a flat structure - dimensions will be part of the shape and not of the type
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[numpy.typing.NDArray[numpy.generic]]
|
the current result |
fetch_all
¶
Fetch a result from the current result stream saved in server memory. The result stream is populated by the save() and save_all() statements. Note that if save_all() statements are used, calling this function twice may give different results.
PARAMETER | DESCRIPTION |
---|---|
check_for_errors |
If true, the function would also check whether run-time errors happened during the program execution and would write to the logger an error message.
TYPE:
|
flat_struct |
results will have a flat structure - dimensions will be part of the shape and not of the type
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[numpy.typing.NDArray[numpy.generic]]
|
all result of current result stream |
has_dataloss
¶
if there was data loss during job execution
save_to_store
¶
Saving to persistent store the NPY data of this result handle
PARAMETER | DESCRIPTION |
---|---|
writer |
An optional writer to override the store defined in QuantumMachinesManager
TYPE:
|
flat_struct |
results will have a flat structure - dimensions will be part of the shape and not of the type
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
The number of items saved |
strict_fetch
¶
Fetch a result from the current result stream saved in server memory. The result stream is populated by the save() and save_all() statements. Note that if save_all() statements are used, calling this function twice with the same item index may give different results.
PARAMETER | DESCRIPTION |
---|---|
item |
The index of the result in the saved results stream.
TYPE:
|
check_for_errors |
If true, the function would also check whether run-time errors happened during the program execution and would write to the logger an error message.
TYPE:
|
flat_struct |
results will have a flat structure - dimensions will be part of the shape and not of the type
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
numpy.typing.NDArray[numpy.generic]
|
a single result if item is integer or multiple results if item is Python slice object. |
wait_for_all_values
¶
Wait until we know all values were processed for this named result
PARAMETER | DESCRIPTION |
---|---|
timeout |
Timeout for waiting in seconds
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
True if job finished successfully and False if job has |
bool
|
closed before done |
wait_for_values
¶
Wait until we know at least count
values were processed for this named result
PARAMETER | DESCRIPTION |
---|---|
count |
The number of items to wait for
TYPE:
|
timeout |
Timeout for waiting in seconds
TYPE:
|
qm.results.streaming_result_fetcher.StreamingResultFetcher
¶
Bases: Mapping
Access to the results of a QmJob
This object is created by calling QmJob.result_handles
Assuming you have an instance of StreamingResultFetcher:
This object is iterable:Can detect if a name exists:
get
¶
Get a handle to a named result from stream_processing
PARAMETER | DESCRIPTION |
---|---|
name |
The named result using in stream_processing
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[BaseStreamingResultFetcher]
|
A handle object to the results |
is_processing
¶
Check if the job is still processing results
RETURNS | DESCRIPTION |
---|---|
bool
|
True if results are still being processed, False otherwise |
items
¶
Returns a view, in which the first item is the name of the result and the second is the result
keys
¶
Returns a view of the names of the results
save_to_store
¶
Save all results to store (file system by default) in a single NPZ file
PARAMETER | DESCRIPTION |
---|---|
writer |
An optional writer to be used instead of the pre- populated store passed to qm.quantum_machines_manager.QuantumMachinesManager
TYPE:
|
flat_struct |
results will have a flat structure - dimensions will be part of the shape and not of the type
TYPE:
|
values
¶
Returns a view of the results
wait_for_all_values
¶
Wait until we know all values were processed for all named results
PARAMETER | DESCRIPTION |
---|---|
timeout |
Timeout for waiting in seconds
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
True if all finished successfully, False if any result was closed before done |
qm.results.single_streaming_result_fetcher.SingleStreamingResultFetcher
¶
Bases: BaseStreamingResultFetcher
A handle to a result of a pipeline terminating with save
fetch
¶
Fetch a single result from the current result stream saved in server memory. The result stream is populated by the save().
PARAMETER | DESCRIPTION |
---|---|
item |
ignored
TYPE:
|
check_for_errors |
If true, the function would also check whether run-time errors happened during the program execution and would write to the logger an error message.
TYPE:
|
flat_struct |
results will have a flat structure - dimensions will be part of the shape and not of the type
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[numpy.typing.NDArray[numpy.generic]]
|
the current result |
fetch_all
¶
Fetch a result from the current result stream saved in server memory. The result stream is populated by the save() and save_all() statements. Note that if save_all() statements are used, calling this function twice may give different results.
PARAMETER | DESCRIPTION |
---|---|
check_for_errors |
If true, the function would also check whether run-time errors happened during the program execution and would write to the logger an error message.
TYPE:
|
flat_struct |
results will have a flat structure - dimensions will be part of the shape and not of the type
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[numpy.typing.NDArray[numpy.generic]]
|
all result of current result stream |
qm.results.multiple_streaming_result_fetcher.MultipleStreamingResultFetcher
¶
Bases: BaseStreamingResultFetcher
A handle to a result of a pipeline terminating with save_all
fetch
¶
Fetch a result from the current result stream saved in server memory. The result stream is populated by the save() and save_all() statements. Note that if save_all() statements are used, calling this function twice with the same item index may give different results.
PARAMETER | DESCRIPTION |
---|---|
item |
The index of the result in the saved results stream.
TYPE:
|
check_for_errors |
If true, the function would also check whether run-time errors happened during the program execution and would write to the logger an error message.
TYPE:
|
flat_struct |
results will have a flat structure - dimensions will be part of the shape and not of the type
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[numpy.typing.NDArray[numpy.generic]]
|
a single result if item is integer or multiple results if item is Python slice object. |
save_to_store
¶
Saving to persistent store the NPY data of this result handle
PARAMETER | DESCRIPTION |
---|---|
writer |
An optional writer to override the store defined in QuantumMachinesManager
TYPE:
|
flat_struct |
results will have a flat structure - dimensions will be part of the shape and not of the type
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
The number of items saved |