Skip to content
Snippets Groups Projects
Commit c96bbc4d authored by Ruud Overeem's avatar Ruud Overeem
Browse files

Bug 1154: Step4 checkin.

parent 9102651a
Branches
Tags
No related merge requests found
......@@ -56,6 +56,10 @@ lofar_INTERNAL(LCS/Transport,Transport,,1,Transport/TransportHolder.h,,)
lofar_INTERNAL(LCS/ACC/APS,APS,,1,APS/ParameterSet.h,,)
lofar_INTERNAL(LCS/ACC/ALC,ALC,,1,ALC/ApplControl.h,,)
lofar_INTERNAL(LCS/ACC/PLC,PLC,,1,PLC/ProcessControl.h,,)
lofar_INTERNAL(MAC/GCF/GCFCommon,GCFCommon,,1,GCF/GCF_ServiceInfo.h,,)
lofar_INTERNAL(MAC/GCF/TM,eventport,,1,GCF/TM/EventPort.h,,)
dnl lofar_INTERNAL(MAC/GCF/TM,gcftm,,1,GCF/TM/GCF_Event.h,,)
lofar_INTERNAL(MAC/APL/APLProtocol,kvt_protocol,,1,APL/APLProtocol/KVT_Protocol.ph,,)
dnl Note: only the test programs depend on the tribool functionality
lofar_EXTERNAL(boost,1,boost/logic/tribool.hpp,"")
......
......@@ -28,6 +28,8 @@
#include <Common/LofarLocators.h>
#include <ALC/ACCmd.h>
#include <PLC/ProcControlComm.h>
#include <GCF/GCF_ServiceInfo.h>
#include <APL/APLProtocol/KVT_Protocol.ph>
#include "ApplController.h"
#include "PR_Shell.h" // TODO: factory!
#include "PR_MPI.h" // TODO: factory!
......@@ -36,6 +38,7 @@
#include "lofarDirs.h"
namespace LOFAR {
using namespace GCF::TM;
namespace ACC {
//
......@@ -52,6 +55,7 @@ ApplController::ApplController(const string& configID) :
itsAPAPool (0),
itsServerStub (0),
itsDaemonComm (0),
itsKVLogger (0),
itsCurTime (0),
itsIsRunning (false),
itsStateEngine (new StateEngine),
......@@ -89,6 +93,7 @@ ApplController::~ApplController()
if (itsAPAPool) { delete itsAPAPool; }
if (itsServerStub) { delete itsServerStub; }
if (itsDaemonComm) { delete itsDaemonComm; }
if (itsKVLogger) { delete itsKVLogger; }
if (itsCurACMsg) { delete itsCurACMsg; }
if (itsStateEngine) { delete itsStateEngine; }
......@@ -121,6 +126,11 @@ void ApplController::startupNetwork()
itsBootParamSet->getString("AC.pinghost"),
itsBootParamSet->getString("AC.pingportnr"),
itsBootParamSet->getString("AC.pingID"));
// client synchrone
itsKVLogger = new EventPort(MAC_SVCMASK_KVTLOGGER, false, KVT_PROTOCOL, "", true);
ASSERTSTR(itsKVLogger, "Can't connect to KeyValueLogger");
itsIsRunning = true;
}
......@@ -172,9 +182,11 @@ void ApplController::handleProcMessage(APAdmin* anAP)
break;
case PCCmdParams: {
// TODO: Write this information to the >>>> KeyValueLogger <<<<
ParameterSet resultParam;
resultParam.adoptBuffer(DHProcPtr->getOptions());
resultParam.writeFile(itsObsParamSet->getString("ApplCtrl.resultfile"), true);
sendToKVLogger(resultParam);
break;
}
......@@ -440,6 +452,41 @@ void ApplController::writeResultFile()
}
}
//
// sendToKVLogger(parSet)
//
// Send the KV pairs to the KeyValueLogger
//
void ApplController::sendToKVLogger(ParameterSet& aResultPS)
{
// loop over PS and construct a msgpool event.
ParameterSet::iterator iter = aResultPS.begin();
ParameterSet::iterator end = aResultPS.end();
KVTSendMsgPoolEvent poolEvent;
poolEvent.seqnr = 1;
poolEvent.msgCount = 0;
while (iter != end) {
poolEvent.keys.theVector.push_back(iter->first);
poolEvent.values.theVector.push_back(iter->second);
poolEvent.msgCount++;
iter++;
}
// empty PS?
if (!poolEvent.msgCount) {
return;
}
// send message and wait for answer.
itsKVLogger->send(&poolEvent);
KVTSendMsgPoolAckEvent poolAck(*(itsKVLogger->receive()));
if (poolAck.result != 0) {
LOG_ERROR_STR("Storing metadata in PVSS resulted in errorcode " << poolAck.result);
}
}
//
// startState (newMsg)
//
......
......@@ -38,6 +38,7 @@
#include <ALC/ApplControlServer.h> //# communication stub
#include <PLC/DH_ProcControl.h>
#include <APS/ParameterSet.h>
#include <GCF/TM/EventPort.h>
#include "ACCmdImpl.h" //# the real implementation
#include "ACDaemonComm.h"
#include "CmdStack.h"
......@@ -80,6 +81,7 @@ private:
// it is only meant to avoid code duplication in createParSubsets
void writeParSubset(ParameterSet ps, const string& procName, const string& fileName);
void writeResultFile ();
void sendToKVLogger (ParameterSet& aResultPS);
void checkForACCommands();
void checkForAPMessages();
......@@ -101,6 +103,7 @@ private:
APAdminPool* itsAPAPool; // Communication with all AP's
ApplControlServer* itsServerStub; // Communication with AM
ACDaemonComm* itsDaemonComm; // Communication with ACDaemon
GCF::TM::EventPort* itsKVLogger; // Connection to KeyValueLogger
time_t itsCurTime; // Current timestamp
bool itsIsRunning; // Alive or not
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment