Commit 2fe8a54c authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

fixing bug in exiting running remote accelerator, added setOptions to python (#58)



Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent b7e5eb73
......@@ -279,7 +279,8 @@ PYBIND11_MODULE(_pyxacc, m) {
&xacc::getService<IRGenerator>, py::return_value_policy::reference,
"Return the IRGenerator of given name.");
m.def("setOption", &xacc::setOption, "Set an XACC framework option.");
m.def("getOption", &xacc::getOption, "Get an XACC framework option.");
m.def("setOptions", [](std::map<std::string,std::string> options) {for (auto& kv : options) xacc::setOption(kv.first,kv.second);}, "Set a number of options at once.");
m.def("getOption", (const std::string (*)(const std::string&)) &xacc::getOption, "Get an XACC framework option.");
m.def("hasAccelerator", &xacc::hasAccelerator, "Does XACC have the given Accelerator installed?");
m.def("hasCompiler", &xacc::hasCompiler, "Does XACC have the given Accelerator installed?");
m.def("optionExists", &xacc::optionExists, "Set an XACC framework option.");
......
......@@ -73,10 +73,10 @@ def setCredentials(opts):
f.write('user_id: ' + user + '\n')
f.write('url: ' + url + '\n')
f.close()
elif acc == 'ibm' and not opts.hub == None:
elif acc == 'ibm' and (opts.group != None or opts.project != None):
# We have hub,group,project info coming in.
if opts.group == None or opts.project == None:
print('Error, if you provide a hub, you must provide group and project')
if (opts.group != None and opts.project == None) or (opts.group == None and opts.project != None):
print('Error, you must provide both group and project')
sys.exit(1)
f = open(os.environ['HOME']+'/.'+acc+'_config','w')
f.write('key: '+ opts.api_key + '\n')
......
......@@ -142,6 +142,9 @@ protected:
ex = e;
xacc::info("Remote Accelerator " + name() + " caught exception while calling restClient->get() "
"- " + std::string(e.what()));
if (boost::contains(std::string(e.what()), "Caught CTRL-C")) {
xacc::error(std::string(e.what()));
}
retries--;
if (retries > 0) {
xacc::info("Retrying HTTP Get.");
......
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