Migrating to v0.25.0: QRMI is_accessible() is now deprecated. Use status() instead#
Up through v0.24.x, the only way to check a QuantumResource was
is_accessible(), which returns a single boolean.
This release adds status(), which returns a richer ResourceStatus: a
status code (online / offline / paused) plus optional details such
as the status reason, health, busy state, slot capacity and pending job count.
is_accessible() is now deprecated in every binding. Its behavior is
unchanged, so existing code keeps working, but new code should use
status().
What’s changed#
Language |
Deprecated |
Replacement |
|---|---|---|
Rust |
|
|
C |
|
|
Python |
|
|
Lua |
|
|
ResourceStatus fields#
Field |
Type |
Description |
|---|---|---|
|
|
One of |
|
string, optional |
The vendor-specific status reason. |
|
bool, optional |
Whether the resource is currently healthy. |
|
bool, optional |
Whether the resource is currently busy. |
|
|
Slot capacity, with |
|
integer, optional |
The number of jobs pending in the queue. |
Optional fields are empty (None / nil) when the resource type doesn’t
report them.
How to migrate#
is_accessible() returns true only when quantum workloads can be
executed. A resource that is reachable but can’t run workloads, for
example during maintenance, is not considered accessible. With
status(), that case is reported as paused, so the equivalent of
is_accessible() == true is a status of online only.
Rust — Replace
is_accessible()withstatus()and check itsstatusfield:// Before if qrmi.is_accessible().await? { // ... } // After use qrmi::models::ResourceStatusCode; let st = qrmi.status().await?; if st.status == ResourceStatusCode::Online { // ... }
If you implement the
QuantumResourcetrait yourself, implementstatus(). Its default implementation delegates tois_accessible()and reports onlyOnlineorOffline, so existing implementations keep working until you do.C — Replace
qrmi_resource_is_accessible()withqrmi_resource_status(), then read the fields through the accessor functions:QrmiResourceStatus *st = NULL; if (qrmi_resource_status(qrmi, &st) != QRMI_RETURN_CODE_SUCCESS) { /* handle error */ } QrmiResourceStatusCode code; qrmi_resource_status_code(st, &code); printf("status: %s\n", qrmi_resource_status_code_to_string(code)); if (code == QRMI_RESOURCE_STATUS_CODE_ONLINE) { /* ... */ } char *reason = qrmi_resource_status_reason(st); if (reason != NULL) { printf("reason: %s\n", reason); qrmi_string_free(reason); } qrmi_resource_status_free(st);
Keep these rules in mind:
Release the handle with
qrmi_resource_status_free(), and a capacity handle fromqrmi_resource_status_capacity()withqrmi_resource_capacity_free().qrmi_resource_status_reason()may returnNULL. Free a non-null result withqrmi_string_free().qrmi_resource_status_healthy(),_busy(),_pending_job_count()and_capacity()returnQRMI_RETURN_CODE_UNSUPPORTED_FUNCTION_ERRORwhen the resource doesn’t report that field.qrmi_resource_status_code_to_string()returns a static string. Don’t free it.
Python — Replace
is_accessible()withstatus():from qrmi import ResourceStatusCode # Before if qrmi.is_accessible(): ... # After st = qrmi.status() if st.status == ResourceStatusCode.Online: ... print(st.to_dict()) # JSON-compatible dict
Calling
is_accessible()now emits aDeprecationWarning.Lua — Replace
resource:is_accessible()withresource:status():-- Before local accessible, err = resource:is_accessible() -- After local st, err = resource:status() if not st then error(err) end if st.status == "online" then -- ... end
status()returns a plain Lua table.healthy,busy,pending_job_countandcapacityarenilwhen the resource doesn’t report them.