ExecutionSpan
class ExecutionSpan(start, stop)
Bases: ABC
Abstract parent for classes that store an execution time span for a subset of job data.
A pub is said to have dependence on an execution span if the corresponding execution includes data that forms any part of the pub’s results.
Execution spans are equality checkable, and they implement a comparison operator based on the tuple (start, stop)
, so can be sorted.
Parameters
- start (datetime) – The start time of the span, in UTC.
- stop (datetime) – The stop time of the span, in UTC.
Attributes
duration
The duration of this span, in seconds.
pub_idxs
Which pubs, by index, have dependence on this execution span.
size
The total number of results with dependence on this execution span, across all pubs.
This attribute is equivalent to the sum of the elements of all present mask()
s. For sampler results, it represents the total number of shots with dependence on this execution span.
Combine this attribute with filter_by_pub()
to find the size of some particular pub:
span.filter_by_pub(2).size
start
The start time of the span, in UTC.
stop
The stop time of the span, in UTC.
Methods
contains_pub
contains_pub(pub_idx)
Return whether the pub with the given index has data with dependence on this span.
Parameters
pub_idx (int | Iterable[int]) – One or more pub indices from the original primitive call.
Returns
Whether there is dependence on this span.
Return type
bool
filter_by_pub
abstract filter_by_pub(pub_idx)
Return a new span whose slices are filtered to the provided pub indices.
For example, if this span contains slice information for pubs with indices 1, 3, 4 and [1, 4]
is provided, then the span returned by this method will contain slice information for only those two indices, but be identical otherwise.
Parameters
pub_idx (int | Iterable[int]) – One or more pub indices from the original primitive call.
Returns
A new filtered span.
Return type