Unverified Commit ab5569e3 authored by Mccaskey, Alex's avatar Mccaskey, Alex Committed by GitHub
Browse files

Merge pull request #467 from tnguyen-ornl/tnguyen/ionq-job-status

Added job status logging for IonQ
parents a6b6c06c 2af25b51
Pipeline #154137 passed with stage
in 15 minutes and 29 seconds
......@@ -89,6 +89,7 @@ void IonQAccelerator::processResponse(std::shared_ptr<AcceleratorBuffer> buffer,
std::string jobId = j["id"].get<std::string>();
std::string msg;
bool jobCompleted = false;
int dots = 1;
while (!jobCompleted) {
msg = handleExceptionRestClientGet(url, "/jobs/" + jobId, headers);
......@@ -97,8 +98,32 @@ void IonQAccelerator::processResponse(std::shared_ptr<AcceleratorBuffer> buffer,
jobCompleted = true;
}
// Add a status message...
if (dots > 4) {
dots = 1;
}
std::stringstream ss;
ss << "\033[0;32m"
<< "IonQ Job "
<< "\033[0;36m" << jobId
<< "\033[0;32m"
// IonQ use the word "ready" to denote the submitted job status
<< " Status: "
<< (j["status"].get<std::string>() == "ready"
? "submitted"
: j["status"].get<std::string>());
for (int i = 0; i < dots; i++) {
ss << '.';
}
dots++;
std::cout << '\r' << ss.str() << std::setw(20) << std::setfill(' ')
<< std::flush;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
// End the color log
std::cout << "\033[0m" << "\n";
std::map<std::string, double> histogram =
j["data"]["histogram"].get<std::map<std::string, double>>();
......
......@@ -369,7 +369,15 @@ public:
return mpark::get<T>(*this);
} catch (std::exception &e) {
std::stringstream s;
// Bypass this error logging on Clang
// It will error due to:
// call to function 'operator<<' that is neither visible in the template definition nor found by argument-dependent lookup:
// https://clang.llvm.org/compatibility.html#dep_lookup
// Note: GCC will accept that but not Clang.
// Since this is just an error log, skip it.
#ifndef __clang__
s << "InstructionParameter::this->toString() = " << toString() << "\n";
#endif
s << "This InstructionParameter type id is " << this->which() << "\n";
emit_error("Cannot cast Variant: " + s.str());
// print_backtrace();
......
Supports Markdown
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