Skip to content
Snippets Groups Projects
Commit 97c62af3 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-156: added method getSubTask(int subtask_id)

parent 4f059d74
No related branches found
No related tags found
1 merge request!116TMSS-156: Resolve TMSS-156
......@@ -57,6 +57,15 @@ TMSSBridge::~TMSSBridge()
}
Json::Value TMSSBridge::getSubTask(int subtask_id)
{
string queryStr = "/api/subtask/" + to_string(subtask_id) + "/";
Json::Value result = httpGETAsJson(queryStr);
cout << std::endl << result.toStyledString() << std::endl << std::endl;
return result;
}
//
// get all subTaskIDS that should run within three minutes (ordered in time if multiple are found)
// for given cluster
......@@ -191,11 +200,9 @@ string TMSSBridge::httpQuery(const string& target, const string& query_method, c
curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
curl_easy_cleanup(curl);
cout << "[" << query_method << "] code=" << httpCode << " " << url << std::endl;
if (httpCode == 200)
{
cout << "Got successful response from " << url << " code=" << httpCode << std::endl;
return string(*httpData.get());
}
THROW(TMSSBridgeException, "Couldn't " + query_method + " from " + url + " exiting with http code " + to_string(httpCode));
}
......@@ -208,7 +215,9 @@ Json::Value TMSSBridge::httpGETAsJson(const string& target)
Json::Reader jsonReader;
if (jsonReader.parse(httpResponse, jsonData))
{
cout << "JSON data for " << target << std::endl << jsonData.toStyledString() << std::endl;
// if(jsonData["count"] != 0) {
// cout << "JSON data for " << target << std::endl << jsonData.toStyledString() << std::endl;
// }
return jsonData;
}
......
......@@ -44,6 +44,8 @@ public:
TMSSBridge (const std::string &hostname, int port, const std::string &username, const std::string &password);
~TMSSBridge ();
Json::Value getSubTask(int subtask_id);
Json::Value getSubTasksStartingInThreeMinutes();
Json::Value getActiveSubTasks();
Json::Value getFinishingSubTasks();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment