Commit ecee1ae0 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

updating ibm url to new quantum-computing.ibm.com


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 8347624c
Pipeline #80849 passed with stage
in 4 minutes and 12 seconds
......@@ -181,7 +181,6 @@ your IBM credentials to XACC. To do this add the following to a plain text file
.. code:: bash
key: YOUR_KEY_HERE
url: https://q-console-api.mybluemix.net
hub: HUB
group: GROUP
project: PROJECT
......
......@@ -39,10 +39,6 @@ using namespace rapidjson;
namespace xacc {
namespace quantum {
// keeping this here for later...
// curl -X POST
// https://q-console-api.mybluemix.net/api/Network/ibm-q-ornl/Groups/ornl-internal/Projects/algorithms-team/jobs/JOBID/cancel?access_token=TEMPTOKEN
std::string hex_string_to_binary_string(std::string hex) {
return integral_to_binary_string((int)strtol(hex.c_str(), NULL, 0));
}
......@@ -209,7 +205,7 @@ void IBMAccelerator::initialize(const HeterogeneousMap &params) {
{"Content-Length", std::to_string(tokenParam.length())}};
auto response = handleExceptionRestClientPost(
url, "/api/users/loginWithToken", tokenParam, headers);
"https://auth.quantum-computing.ibm.com", "/api/users/loginWithToken", tokenParam, headers);
if (response.find("error") != std::string::npos) {
xacc::error("Error received from IBM\n" + response);
......@@ -220,7 +216,7 @@ void IBMAccelerator::initialize(const HeterogeneousMap &params) {
currentApiToken = d["id"].GetString();
response =
handleExceptionRestClientGet(url, getBackendPath + currentApiToken);
handleExceptionRestClientGet("https://api-qcon.quantum-computing.ibm.com", getBackendPath + currentApiToken);
auto j = json::parse("{\"backends\":" + response + "}");
from_json(j, backends_root);
......@@ -240,7 +236,7 @@ void IBMAccelerator::initialize(const HeterogeneousMap &params) {
}
auto response = handleExceptionRestClientGet(
url, getBackendPropertiesPath, {},
"https://api-qcon.quantum-computing.ibm.com", getBackendPropertiesPath, {},
{std::make_pair("version", "1"),
std::make_pair("access_token", currentApiToken)});
......@@ -256,7 +252,7 @@ void IBMAccelerator::initialize(const HeterogeneousMap &params) {
// Set these for RemoteAccelerator.execute
postPath = postJobPath + currentApiToken;
remoteUrl = url;
remoteUrl = "https://api-qcon.quantum-computing.ibm.com";
initialized = true;
chosenBackend = availableBackends[backend];
}
......@@ -501,7 +497,7 @@ void IBMAccelerator::processResponse(std::shared_ptr<AcceleratorBuffer> buffer,
std::cout << "Job ID: " << jobId << "\n";
if (!hub.empty()) {
std::cout << "\nTo cancel job, open a new terminal and run:\n\n"
<< "curl -X POST " << url << "/api/Network/" << hub << "/Groups/"
<< "curl -X POST " << "https://api-qcon.quantum-computing.ibm.com/api/Network/" << hub << "/Groups/"
<< group << "/Projects/" << project << "/jobs/" << jobId
<< "/cancel?access_token=" << currentApiToken
<< "\n\n-or-\n\nCTRL-C\n\n";
......@@ -513,7 +509,7 @@ void IBMAccelerator::processResponse(std::shared_ptr<AcceleratorBuffer> buffer,
bool jobCompleted = false;
while (!jobCompleted) {
getResponse = handleExceptionRestClientGet(url, getPath);
getResponse = handleExceptionRestClientGet("https://api-qcon.quantum-computing.ibm.com", getPath);
// auto jj = json::parse(getResponse);
if (getResponse.find("COMPLETED") != std::string::npos) {
......
......@@ -1821,7 +1821,9 @@ inline void from_json(const json &j, xacc::ibm_backend::BackendTopology &x) {
x.set_allow_open_pulse(j.at("allowOpenPulse").get<bool>());
x.set_deleted(j.at("deleted").get<bool>());
x.set_id(j.at("id").get<std::string>());
if (j.find("qconsole") != j.end()) {
x.set_qconsole(j.at("qconsole").get<bool>());
}
x.set_is_hidden(j.at("isHidden").get<bool>());
x.set_allow_object_storage(
xacc::ibm_backend::get_optional<bool>(j, "allowObjectStorage"));
......@@ -1861,7 +1863,7 @@ inline void from_json(const json &j, xacc::ibm_backend::Backend &x) {
j.at("specificConfiguration").get<xacc::ibm_backend::SpecificConfiguration>());
if (j.find("id") != j.end()) {x.set_id(j.at("id").get<std::string>());}
if (j.find("topologyId") != j.end()) {x.set_topology_id(j.at("topologyId").get<std::string>());}
x.set_qconsole(j.at("qconsole").get<bool>());
if (j.find("qconsole") != j.end()) x.set_qconsole(j.at("qconsole").get<bool>());
if (j.find("topology") != j.end()) {x.set_topology(j.at("topology").get<xacc::ibm_backend::BackendTopology>());}
x.set_version(xacc::ibm_backend::get_optional<std::string>(j, "version"));
x.set_description(xacc::ibm_backend::get_optional<std::string>(j, "description"));
......
......@@ -159,7 +159,7 @@ namespace nlohmann {
inline void from_json(const json & j, xacc::ibm_properties::Qubit& x) {
x.set_date(j.at("date").get<std::string>());
x.set_name(j.at("name").get<xacc::ibm_properties::Name>());
if (j.find("name") != j.end()) x.set_name(j.at("name").get<xacc::ibm_properties::Name>());
x.set_unit(xacc::ibm_properties::Unit::EMPTY);//j.at("unit").get<xacc::ibm_properties::Unit>());
x.set_value(j.at("value").get<double>());
}
......@@ -174,7 +174,7 @@ namespace nlohmann {
inline void from_json(const json & j, xacc::ibm_properties::GateElement& x) {
x.set_gate(j.at("gate").get<xacc::ibm_properties::GateEnum>());
x.set_name(j.at("name").get<std::string>());
if (j.find("name") != j.end())x.set_name(j.at("name").get<std::string>());
x.set_parameters(j.at("parameters").get<std::vector<xacc::ibm_properties::Qubit>>());
x.set_qubits(j.at("qubits").get<std::vector<int64_t>>());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment