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

Bug 1000: Solved some timing issues after tests of Arno.

parent 0dc0e2d6
No related branches found
No related tags found
No related merge requests found
......@@ -609,7 +609,7 @@ void MACScheduler::_updatePlannedList()
string filename(observationParset(obsID));
if (!tm.exportTree(obsID, topNode.nodeID(), filename)) {
LOG_ERROR_STR ("Cannot create ParameterSet '" << filename <<
"' for new observatio. Observation CANNOT BE STARTED!");
"' for new observation. Observation CANNOT BE STARTED!");
}
else {
// Claim a DP in PVSS and write obssettings to it so the operator can see it.
......@@ -618,9 +618,11 @@ void MACScheduler::_updatePlannedList()
itsPreparedObs[obsID] = false; // requested claim but no answer yet.
}
}
// always add to PVSS list.
plannedArr.push_back(new GCFPVString(obsName));
else {
// only add observations to the PVSS list when the claim was succesfull
// otherwise thing will go wrong in the Navigator
plannedArr.push_back(new GCFPVString(obsName));
}
// should this observation (have) be(en) started?
time_duration timeBeforeStart(plannedDBlist[idx].starttime - currentTime);
......
......@@ -150,7 +150,7 @@ GCFEvent::TResult ObsClaimer::idle_state (GCFEvent& event, GCFPortInterface& por
iter->second->state = OS_CLAIMING;
itsClaimMgrTask->claimObject("Observation", "LOFAR_ObsSW_"+iter->second->obsName, *itsITCPort);
// will result in CM_CLAIM_RESULT event
break;
break; // claim one at the time.
}
++iter;
}
......@@ -212,7 +212,7 @@ GCFEvent::TResult ObsClaimer::preparePVSS_state (GCFEvent& event, GCFPortInterfa
// Always exit this event in a way that GCF can end the construction.
DPCreatedEvent dpEvent(event);
LOG_DEBUG_STR("Result of creating " << dpEvent.DPname << " = " << dpEvent.result);
itsTimerPort->cancelAllTimers();
// itsTimerPort->cancelAllTimers();
itsTimerPort->setTimer(0.0);
}
break;
......
......@@ -144,7 +144,7 @@ GCFEvent::TResult ClaimMgrTask::operational(GCFEvent& event, GCFPortInterface& p
case F_INIT: {
LOG_DEBUG("Create propertySet for accessing the ClaimManaher");
itsResolveState = RO_CREATING;
itsResolveState = RO_CREATING; // 1
itsClaimMgrPS = new RTDBPropertySet("ClaimManager", "ClaimManager", PSAT_RW, this);
itsTimerPort->setTimer(5.0);
}
......@@ -153,7 +153,7 @@ GCFEvent::TResult ClaimMgrTask::operational(GCFEvent& event, GCFPortInterface& p
case DP_CREATED: {
DPCreatedEvent dpEvent(event);
LOG_DEBUG_STR("Result of creating '" << dpEvent.DPname << "' = " << dpEvent.result);
itsResolveState = RO_CREATED;
itsResolveState = RO_CREATED; // 2
itsTimerPort->cancelAllTimers();
itsTimerPort->setTimer(0.5); // give RTDB time to get the original value.
}
......@@ -165,21 +165,19 @@ GCFEvent::TResult ClaimMgrTask::operational(GCFEvent& event, GCFPortInterface& p
LOG_DEBUG_STR("itsResolveState=" << itsResolveState);
switch (itsResolveState) {
case RO_CREATED:
case RO_CREATED: // 2
itsResolveState = RO_READY;
itsTimerPort->setTimer(0.1);
break;
case RO_READY:
case RO_READY: // 4
if (itsObjectType.empty() || itsNameInAppl.empty()) {
LOG_DEBUG_STR("Nothing to claim");
break;
}
// request a DPname
itsClaimMgrPS->setValue("request.typeName",
GCFPVString(itsObjectType), 0.0, false);
itsClaimMgrPS->setValue("request.newObjectName",
GCFPVString(itsNameInAppl), 0.0, false);
itsClaimMgrPS->setValue("request.typeName", GCFPVString(itsObjectType), 0.0, false);
itsClaimMgrPS->setValue("request.newObjectName", GCFPVString(itsNameInAppl), 0.0, false);
itsClaimMgrPS->flush();
itsResolveState = RO_ASKED;
// clear result fields
......@@ -188,8 +186,10 @@ GCFEvent::TResult ClaimMgrTask::operational(GCFEvent& event, GCFPortInterface& p
itsTimerPort->setTimer(3.0); // don't wait forever.
break;
case RO_ASKED:
LOG_ERROR_STR("No response from ClaimManager in 3 seconds");
case RO_ASKED: // 3
LOG_ERROR_STR("No response from ClaimManager in 3 seconds, retrying");
itsResolveState = RO_READY;
itsTimerPort->setTimer(0.0);
// ???
break;
}
......@@ -208,17 +208,11 @@ GCFEvent::TResult ClaimMgrTask::operational(GCFEvent& event, GCFPortInterface& p
<< fldContents <<"' iso " << itsNameInAppl);
itsFieldsReceived++;
}
else if (dpEvent.DPname.find("response.typeName") != string::npos) {
string fldContents(((GCFPVString*)(dpEvent.value._pValue))->getValue());
ASSERTSTR(fldContents == itsObjectType, "CM returned answer for type '"
<< fldContents <<"' iso " << itsObjectType);
itsFieldsReceived++;
}
else if (dpEvent.DPname.find("response.DPName") != string::npos) {
itsResultDPname = ((GCFPVString*)(dpEvent.value._pValue))->getValue();
itsFieldsReceived++;
}
if (itsFieldsReceived >= 3) {
if (itsFieldsReceived >= 2) {
LOG_DEBUG_STR("ClaimMgr:" << itsNameInAppl << "=" << itsResultDPname);
// Report claimresult back to the user
CMClaimResultEvent cmEvent;
......@@ -226,12 +220,12 @@ GCFEvent::TResult ClaimMgrTask::operational(GCFEvent& event, GCFPortInterface& p
cmEvent.nameInAppl = itsNameInAppl;
cmEvent.DPname = itsResultDPname;
itsReplyPort->send(cmEvent);
// clear admin to reaceive a new calim request.
// clear admin to receive a new claim request.
itsObjectType.clear();
itsNameInAppl.clear();
itsResultDPname.clear();
itsResolveState = RO_READY;
itsTimerPort->cancelAllTimers();
// itsTimerPort->cancelAllTimers();
}
}
break;
......
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