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

Task #3571: MACScheduler uses modificationDate. Modifying an already scheduled...

Task #3571: MACScheduler uses modificationDate. Modifying an already scheduled tree will immediately result in a new parsetfile for that observation/pipeline.
parent 9db94fd1
No related branches found
No related tags found
No related merge requests found
...@@ -373,7 +373,7 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface& ...@@ -373,7 +373,7 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
// claim was successful, update admin // claim was successful, update admin
LOG_INFO_STR("Observation " << obsID << " is mapped to " << cmEvent.DPname); LOG_INFO_STR("Observation " << obsID << " is mapped to " << cmEvent.DPname);
LOG_DEBUG_STR("PVSS preparation of observation " << obsID << " ready."); LOG_DEBUG_STR("PVSS preparation of observation " << obsID << " ready.");
itsPreparedObs[obsID] = true; itsPreparedObs[obsID].prepReady = true;
} }
break; break;
...@@ -620,6 +620,7 @@ void MACScheduler::_updatePlannedList() ...@@ -620,6 +620,7 @@ void MACScheduler::_updatePlannedList()
// construct name and timings info for observation // construct name and timings info for observation
treeIDType obsID = plannedDBlist[idx].treeID(); treeIDType obsID = plannedDBlist[idx].treeID();
string obsName(observationName(obsID)); string obsName(observationName(obsID));
ptime modTime = plannedDBlist[idx].modificationDate;
// remove obs from backup of the planned-list (it is in the list again) // remove obs from backup of the planned-list (it is in the list again)
OLiter oldObsIter = backupObsList.find(obsID); OLiter oldObsIter = backupObsList.find(obsID);
...@@ -629,7 +630,8 @@ void MACScheduler::_updatePlannedList() ...@@ -629,7 +630,8 @@ void MACScheduler::_updatePlannedList()
// must we claim this observation at the claimMgr? // must we claim this observation at the claimMgr?
OLiter prepIter = itsPreparedObs.find(obsID); OLiter prepIter = itsPreparedObs.find(obsID);
if ((prepIter == itsPreparedObs.end()) || (prepIter->second == false)) { if ((prepIter == itsPreparedObs.end()) || (prepIter->second.prepReady == false) ||
(prepIter->second.modTime != modTime)) {
// create a ParameterFile for this Observation // create a ParameterFile for this Observation
TreeMaintenance tm(itsOTDBconnection); TreeMaintenance tm(itsOTDBconnection);
OTDBnode topNode = tm.getTopNode(obsID); OTDBnode topNode = tm.getTopNode(obsID);
...@@ -642,7 +644,7 @@ void MACScheduler::_updatePlannedList() ...@@ -642,7 +644,7 @@ void MACScheduler::_updatePlannedList()
// Claim a DP in PVSS and write obssettings to it so the operator can see it. // Claim a DP in PVSS and write obssettings to it so the operator can see it.
LOG_DEBUG_STR("Requesting preparation of PVSS for " << obsName); LOG_DEBUG_STR("Requesting preparation of PVSS for " << obsName);
itsClaimerTask->prepareObservation(obsName); itsClaimerTask->prepareObservation(obsName);
itsPreparedObs[obsID] = false; // requested claim but no answer yet. itsPreparedObs[obsID] = schedInfo(modTime, false); // requested claim but no answer yet.
} }
} }
else { else {
...@@ -655,7 +657,7 @@ void MACScheduler::_updatePlannedList() ...@@ -655,7 +657,7 @@ void MACScheduler::_updatePlannedList()
int timeBeforeStart = time_duration(plannedDBlist[idx].starttime - currentTime).total_seconds(); int timeBeforeStart = time_duration(plannedDBlist[idx].starttime - currentTime).total_seconds();
// LOG_DEBUG_STR(obsName << " starts over " << timeBeforeStart << " seconds"); // LOG_DEBUG_STR(obsName << " starts over " << timeBeforeStart << " seconds");
if (timeBeforeStart > 0 && timeBeforeStart <= (int)itsQueuePeriod) { if (timeBeforeStart > 0 && timeBeforeStart <= (int)itsQueuePeriod) {
if (itsPreparedObs[obsID] == false) { if (itsPreparedObs[obsID].prepReady == false) {
LOG_ERROR_STR("Observation " << obsID << " must be started but is not claimed yet."); LOG_ERROR_STR("Observation " << obsID << " must be started but is not claimed yet.");
} }
else { else {
......
...@@ -122,8 +122,15 @@ private: ...@@ -122,8 +122,15 @@ private:
// Define a list in which we keep the obsID's of the observations we prepared PVSS for. // Define a list in which we keep the obsID's of the observations we prepared PVSS for.
// When an obs is in the list we at least have sent a claim request to PVSS. When the // When an obs is in the list we at least have sent a claim request to PVSS. When the
// second value it true we succeeded the claim and we don't have to claim it again. // second value it true we succeeded the claim and we don't have to claim it again.
typedef map<int /*obsID*/, bool /*prepReady*/> ObsList; class schedInfo {
typedef map<int ,bool>::iterator OLiter; public:
ptime modTime;
bool prepReady;
schedInfo(ptime t, bool p) : modTime(t), prepReady(p) {};
schedInfo() : modTime(min_date_time), prepReady(false) {};
};
typedef map<int /*obsID*/, schedInfo /*prepReady*/> ObsList;
typedef map<int ,schedInfo>::iterator OLiter;
ObsList itsPreparedObs; // Observations we already prepared PVSS for. ObsList itsPreparedObs; // Observations we already prepared PVSS for.
// Ports for StartDaemon and ObservationControllers. // Ports for StartDaemon and ObservationControllers.
......
...@@ -1215,6 +1215,17 @@ create_cpp_headerfile() ...@@ -1215,6 +1215,17 @@ create_cpp_headerfile()
echo "#endif" >>${DESTDIR}/${CPP_HEADERFILE} echo "#endif" >>${DESTDIR}/${CPP_HEADERFILE}
} }
check_start_dir()
{
if [ -f PVSSbase.dpdef ]; then
return
else
echo "Start create_db_files from the directory with the PVSS datafiles"
echo "Start with ../bin/create_db_files [options]"
echo
exit
fi
}
#------------------------------ MAIN program ------------------------------ #------------------------------ MAIN program ------------------------------
# #
# Syntax: create_db_files [-d destdir] [-s station | -C] # Syntax: create_db_files [-d destdir] [-s station | -C]
...@@ -1278,8 +1289,9 @@ elif [ "$DBTYPE" == "M" ]; then ...@@ -1278,8 +1289,9 @@ elif [ "$DBTYPE" == "M" ]; then
cd $DESTDIR cd $DESTDIR
echo "Making files for $STNNAME in $DESTDIR" echo "Making files for $STNNAME in $DESTDIR"
else else
configdir=".." check_start_dir
dpdefdir="" configdir="../../"
dpdefdir="../data/"
fi fi
elif [ "$DBTYPE" == "C" ]; then elif [ "$DBTYPE" == "C" ]; then
if [ "$HOSTNAME" == "CCU001" -o "$HOSTNAME" == "CCU099" ]; then if [ "$HOSTNAME" == "CCU001" -o "$HOSTNAME" == "CCU099" ]; then
...@@ -1290,12 +1302,14 @@ elif [ "$DBTYPE" == "C" ]; then ...@@ -1290,12 +1302,14 @@ elif [ "$DBTYPE" == "C" ]; then
cd $DESTDIR cd $DESTDIR
echo "Making files for $STNNAME in $DESTDIR" echo "Making files for $STNNAME in $DESTDIR"
else else
configdir=".." check_start_dir
dpdefdir="" configdir="../../"
dpdefdir="../data/"
fi fi
else else
configdir=".." check_start_dir
dpdefdir="" configdir="../.."
dpdefdir="../data"
STNNAME=$DBTYPENAME STNNAME=$DBTYPENAME
fi fi
...@@ -1306,12 +1320,12 @@ if [ ! -f $STATIONINFOFILE ]; then ...@@ -1306,12 +1320,12 @@ if [ ! -f $STATIONINFOFILE ]; then
exit exit
fi fi
COMPONENT_FILE=${dpdefdir}PVSSbase.dpdef COMPONENT_FILE=${dpdefdir}/PVSSbase.dpdef
CLUSTERFILE=${dpdefdir}Clusters.list CLUSTERFILE=${dpdefdir}/Clusters.list
RINGFILE=${dpdefdir}Rings.list RINGFILE=${dpdefdir}/Rings.list
WANFILE=${dpdefdir}Wan.list WANFILE=${dpdefdir}/Wan.list
ERRORFILE=/tmp/Crea.Error ERRORFILE=/tmp/Crea.Error
INPUTFILE=${dpdefdir}PVSSDataPoints.base INPUTFILE=${dpdefdir}/PVSSDataPoints.base
# define the output files # define the output files
CPP_HEADERFILE=PVSSDatapointDefs.h CPP_HEADERFILE=PVSSDatapointDefs.h
......
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