QPU Discovery and Status¶
The SDK provides methods for inspecting QPU capabilities, calibration, and
availability before submitting jobs. All methods are available directly on the
OqcSdk instance and support the default-QPU pattern — pass qpu_id
explicitly, or set a default with set_default_qpu()
and omit it.
Listing and Selecting QPUs¶
list_qpus() returns all QPUs currently active on
the connected server:
qpus = await sdk.list_qpus()
for qpu in qpus:
print(qpu["id"], qpu["name"])
A common pattern is to discover QPUs at startup and set the most appropriate one as the default for the session:
qpus = await sdk.list_qpus()
simulator = next(q for q in qpus if "Simulator" in q.get("name", ""))
sdk.set_default_qpu(simulator["id"])
# All subsequent calls that accept qpu_id use the default
job = sdk.create_job(program=qasm_str)
features = await sdk.get_features()
Features¶
get_features() returns the feature set for a QPU —
maximum shot count, supported gates, error mitigation options, and so on:
features = await sdk.get_features(qpu_id="qpu:uk:2:d865b5a184")
max_shots = features.get("Maximum Shots")
print(f"Max shots: {max_shots}")
This can be used to validate a job configuration before submitting it.
System Status¶
get_system_status() returns the current health and
availability of a QPU. Pass a qpu_id for a single QPU, or omit it to query
all QPUs concurrently:
# Single QPU
status = await sdk.get_system_status(qpu_id="qpu:uk:2:d865b5a184")
# All QPUs (returns a list)
all_status = await sdk.get_system_status()
Calibration Data¶
get_calibration() returns the latest calibration
data for a QPU (T1/T2 times, gate fidelities, etc.):
cal = await sdk.get_calibration(qpu_id="qpu:uk:2:d865b5a184")
To request calibration data for a specific date, pass a date_filter. The
SDK accepts a datetime.date, a datetime.datetime, or an ISO-format
string — all are normalised to YYYY-MM-DD before being sent to the server:
import datetime
# All three are equivalent
cal = await sdk.get_calibration(qpu_id=qpu_id, date_filter=datetime.date(2025, 1, 15))
cal = await sdk.get_calibration(qpu_id=qpu_id, date_filter=datetime.datetime(2025, 1, 15, 9, 0))
cal = await sdk.get_calibration(qpu_id=qpu_id, date_filter="2025-01-15")
Passing a string in any other format raises a ValueError with a clear
message rather than silently sending a malformed request to the server.
Execution Windows¶
Some QPUs operate in scheduled execution windows. Use
get_next_window() to find out when the next window
opens:
window = await sdk.get_next_window(qpu_id="qpu:uk:2:d865b5a184")
if window is not None:
print(f"Next window starts: {window}")
else:
print("No upcoming window scheduled")
Returns a datetime object, or None if no window is currently scheduled.