Skip to content

Commit

Permalink
Fixed path of GET call to get number of qubits in IBM Accelerator
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Claudino <claudinodc@ornl.gov>
  • Loading branch information
danclaudino committed Dec 17, 2024
1 parent ac157ec commit 210fa27
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions quantum/plugins/ibm/accelerator/IBMAccelerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,29 @@ void IBMAccelerator::selectBackend(std::vector<std::string>& all_available_backe

for (std::string b : backends_root["devices"]) {

const std::string path("/runtime/backends/" + b + "/status");
auto backend_json = json::parse(get(IBM_API_URL, path, headers, {{"name", b}}));

// Simple case: select by backend_name
if (!lowest_queue_backend) {

if (b == backend) {

if(caseInsensitiveCompare(backend_json["status"].get<std::string>(), "active")) {
//availableBackends.insert(std::make_pair(backend, backend_json));
const std::string path("/runtime/backends/" + b + "/status");
auto backend_status_json =
json::parse(get(IBM_API_URL, path, headers, {{"name", b}}));
if (caseInsensitiveCompare(
backend_status_json["status"].get<std::string>(), "active")) {
availableBackends.push_back(b);
} else {
xacc::error(backend + "not active at the moment.");
}
}
} else {
const std::string path("/runtime/backends/" + b + "/configuration");
auto backend_json =
json::parse(get(IBM_API_URL, path, headers, {{"name", b}}));
// Select backend by job queue size and by parameters (optional)
processBackendCandidate(backend_json);
}
all_available_backends.push_back(b);

}
if (lowest_queue_backend) {
xacc::info("Backend with lowest queue count: " + backend);
Expand Down

0 comments on commit 210fa27

Please sign in to comment.