3 #include <Poco/Logger.h>
26 const std::string& tasksDataDir_,
const std::string& tasksStatusDir_,
27 const std::string& nodeHost_,
const std::string& nodePort_)
29 messagesCollection(message_const::
messages), message(messagesCollection), notificationExecutor(),
30 asyncTaskQueue(*this, notificationExecutor, message), resourceMonitor(asyncTaskQueue, message), requestTime(0)
106 resultData.
addDataItem(std::forward<HCE::drce::DRCEResultDataItem>(resultDataItem));
109 outputJsonMessage.
setResultData(std::forward<HCE::drce::DRCEResultData>(resultData));
111 std::string resultJsonMessage;
112 if (!outputJsonMessage.
serialize(resultJsonMessage))
114 std::stringstream errMsg;
116 Poco::Logger::root().log(Poco::Message(
drce_const::moduleName, errMsg.str(), Poco::Message::Priority::PRIO_ERROR));
118 return resultJsonMessage;
129 if (chdir(homeDir_.c_str())==0)
209 resourceMonitor.
dump(statVariables, avgCounts);
217 statVars.insert(avgVars.begin(), avgVars.end());
229 resourceMonitor.
restore(statVariables, avgCounts);
245 return asyncTaskQueue.
hasTask(taskId);
266 Poco::Message::Priority::PRIO_ERROR));
279 resourceUsageSerializator.
serialize(result);
280 if (resourceUsageSerializator.
isError())
284 Poco::Message::Priority::PRIO_ERROR));
287 catch(Poco::Exception& e)
291 Poco::Message::Priority::PRIO_ERROR));
296 std::string DRCEFunctionalObject::getDefaultJSON(
const std::string& jsonErrorMessage,
unsigned int jsonErrorCode)
319 if (inputJsonMessage.
isError())
327 catch(Poco::Exception& e)
335 Poco::Message::Priority::PRIO_ERROR));
344 Poco::Timestamp tsStart;
349 if (!process(inputJsonMessage, resultDataItem))
354 DRCETaskRequest::TaskState::UNDEFINED);
356 resultData.
addDataItem(std::forward<DRCEResultDataItem>(resultDataItem));
361 return outputMessage;
369 Poco::SharedPtr<DRCETaskRequest> pTaskRequest = inputJsonMessage.
getTaskRequest();
370 if (pTaskRequest.isNull())
374 asyncTaskQueue, *
this, message, resourceMonitor);
376 if (pTaskRequestExecutor.isNull())
379 pTaskRequest->setTaskId(inputJsonMessage.
getRequestId());
381 if (pTaskRequest->getRequestType() == DRCETaskRequest::RequestType::rtSetTaskExecute)
384 resultDataItem = pTaskRequestExecutor->execute(pTaskRequest.get(), inputJsonMessage);
388 catch(Poco::Exception& e)
393 Poco::Logger::root().log(Poco::Message(
drce_const::moduleName, e.displayText(), Poco::Message::Priority::PRIO_ERROR));
395 catch(std::exception& e)
400 Poco::Logger::root().log(Poco::Message(
drce_const::moduleName, e.what(), Poco::Message::Priority::PRIO_ERROR));