Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
3bf7dfcc
Commit
3bf7dfcc
authored
17 years ago
by
Ruud Overeem
Browse files
Options
Downloads
Patches
Plain Diff
BugID: 1000
Scheduler start 1 observation per poll cycle to avoid sync problems in PA.
parent
9b1ae5c2
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
+67
-25
67 additions, 25 deletions
MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
with
67 additions
and
25 deletions
MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
+
67
−
25
View file @
3bf7dfcc
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include
<boost/shared_array.hpp>
#include
<boost/shared_array.hpp>
#include
<APS/ParameterSet.h>
#include
<APS/ParameterSet.h>
#include
<GCF/TM/GCF_Protocols.h>
#include
<GCF/GCF_ServiceInfo.h>
#include
<GCF/GCF_ServiceInfo.h>
#include
<GCF/GCF_PVTypes.h>
#include
<GCF/GCF_PVTypes.h>
#include
<GCF/Protocols/PA_Protocol.ph>
#include
<GCF/Protocols/PA_Protocol.ph>
...
@@ -96,9 +97,9 @@ MACScheduler::MACScheduler() :
...
@@ -96,9 +97,9 @@ MACScheduler::MACScheduler() :
itsObservations
.
reserve
(
10
);
// already reserve memory for 10 observations.
itsObservations
.
reserve
(
10
);
// already reserve memory for 10 observations.
registerProtocol
(
CONTROLLER_PROTOCOL
,
CONTROLLER_PROTOCOL_
signalnames
);
GCF
::
TM
::
registerProtocol
(
CONTROLLER_PROTOCOL
,
CONTROLLER_PROTOCOL_
STRINGS
);
registerProtocol
(
PA_PROTOCOL
,
PA_PROTOCOL_
signalnames
);
GCF
::
TM
::
registerProtocol
(
PA_PROTOCOL
,
PA_PROTOCOL_
STRINGS
);
registerProtocol
(
F_PML_PROTOCOL
,
F_PML_PROTOCOL_
signalnames
);
GCF
::
TM
::
registerProtocol
(
F_PML_PROTOCOL
,
F_PML_PROTOCOL_
STRINGS
);
}
}
...
@@ -138,7 +139,7 @@ void MACScheduler::sigintHandler(int signum)
...
@@ -138,7 +139,7 @@ void MACScheduler::sigintHandler(int signum)
void
MACScheduler
::
handlePropertySetAnswer
(
GCFEvent
&
answer
)
void
MACScheduler
::
handlePropertySetAnswer
(
GCFEvent
&
answer
)
{
{
LOG_DEBUG_STR
(
"handlePropertySetAnswer:"
<<
ev
tstr
(
answer
));
LOG_DEBUG_STR
(
"handlePropertySetAnswer:"
<<
ev
entName
(
answer
));
switch
(
answer
.
signal
)
{
switch
(
answer
.
signal
)
{
case
F_MYPS_ENABLED
:
{
case
F_MYPS_ENABLED
:
{
...
@@ -204,7 +205,7 @@ void MACScheduler::handlePropertySetAnswer(GCFEvent& answer)
...
@@ -204,7 +205,7 @@ void MACScheduler::handlePropertySetAnswer(GCFEvent& answer)
//
//
GCFEvent
::
TResult
MACScheduler
::
initial_state
(
GCFEvent
&
event
,
GCFPortInterface
&
/*port*/
)
GCFEvent
::
TResult
MACScheduler
::
initial_state
(
GCFEvent
&
event
,
GCFPortInterface
&
/*port*/
)
{
{
LOG_DEBUG_STR
(
"initial_state:"
<<
ev
tstr
(
event
));
LOG_DEBUG_STR
(
"initial_state:"
<<
ev
entName
(
event
));
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
...
@@ -282,7 +283,7 @@ GCFEvent::TResult MACScheduler::initial_state(GCFEvent& event, GCFPortInterface&
...
@@ -282,7 +283,7 @@ GCFEvent::TResult MACScheduler::initial_state(GCFEvent& event, GCFPortInterface&
//
//
GCFEvent
::
TResult
MACScheduler
::
recover_state
(
GCFEvent
&
event
,
GCFPortInterface
&
port
)
GCFEvent
::
TResult
MACScheduler
::
recover_state
(
GCFEvent
&
event
,
GCFPortInterface
&
port
)
{
{
LOG_DEBUG_STR
(
"recover_state:"
<<
ev
tstr
(
event
)
<<
"@"
<<
port
.
getName
());
LOG_DEBUG_STR
(
"recover_state:"
<<
ev
entName
(
event
)
<<
"@"
<<
port
.
getName
());
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
...
@@ -319,7 +320,7 @@ GCFEvent::TResult MACScheduler::recover_state(GCFEvent& event, GCFPortInterface&
...
@@ -319,7 +320,7 @@ GCFEvent::TResult MACScheduler::recover_state(GCFEvent& event, GCFPortInterface&
//
//
GCFEvent
::
TResult
MACScheduler
::
active_state
(
GCFEvent
&
event
,
GCFPortInterface
&
port
)
GCFEvent
::
TResult
MACScheduler
::
active_state
(
GCFEvent
&
event
,
GCFPortInterface
&
port
)
{
{
LOG_DEBUG_STR
(
"active:"
<<
ev
tstr
(
event
)
<<
"@"
<<
port
.
getName
());
LOG_DEBUG_STR
(
"active:"
<<
ev
entName
(
event
)
<<
"@"
<<
port
.
getName
());
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
...
@@ -388,22 +389,50 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
...
@@ -388,22 +389,50 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
// observationController was started (or not)
// observationController was started (or not)
CONTROLStartedEvent
msg
(
event
);
CONTROLStartedEvent
msg
(
event
);
if
(
msg
.
successful
)
{
if
(
msg
.
successful
)
{
LOG_DEBUG_STR
(
"Start of "
<<
msg
.
cntlrName
<<
" was successful"
);
LOG_DEBUG_STR
(
"Start of "
<<
msg
.
cntlrName
<<
" was successful, waiting for connection."
);
// ---
// Ok, controller is really up, update SAS so that obs will not appear in
// in the SAS list again.
Observation
*
theObs
(
_findActiveObservation
(
msg
.
cntlrName
));
if
(
!
theObs
)
{
LOG_WARN_STR
(
"Cannot find controller "
<<
msg
.
cntlrName
<<
". Can't update the SAS database"
);
break
;
}
OTDB
::
TreeMaintenance
tm
(
itsOTDBconnection
);
TreeStateConv
tsc
(
itsOTDBconnection
);
tm
.
setTreeState
(
theObs
->
treeID
,
tsc
.
get
(
"queued"
));
// ---
}
}
else
{
else
{
LOG_ERROR_STR
(
"Observation controller "
<<
msg
.
cntlrName
<<
LOG_ERROR_STR
(
"Observation controller "
<<
msg
.
cntlrName
<<
" could not be started"
);
" could not be started"
);
LOG_INFO
(
"Observation will be removed from administration"
);
LOG_INFO_STR
(
"Observation is be removed from administration, "
<<
"restart will occur in next cycle"
);
_removeActiveObservation
(
msg
.
cntlrName
);
_removeActiveObservation
(
msg
.
cntlrName
);
}
}
break
;
break
;
}
}
// TODO: the ObsControls don't send the CONTROL_CONNECT yet.
// so the code is copied to the CONTROL STARTED event for now.
case
CONTROL_CONNECT
:
{
case
CONTROL_CONNECT
:
{
// The observationController has registered itself at childControl.
// The observationController has registered itself at childControl.
CONTROLConnectEvent
conEvent
(
event
);
CONTROLConnectEvent
conEvent
(
event
);
LOG_DEBUG_STR
(
"Received CONNECT("
<<
conEvent
.
cntlrName
<<
")"
);
LOG_DEBUG_STR
(
conEvent
.
cntlrName
<<
" is connected, updating SAS)"
);
// TODO: do something usefull with this information?
// Ok, controller is really up, update SAS so that obs will not appear in
// in the SAS list again.
Observation
*
theObs
(
_findActiveObservation
(
conEvent
.
cntlrName
));
if
(
!
theObs
)
{
LOG_WARN_STR
(
"Cannot find controller "
<<
conEvent
.
cntlrName
<<
". Can't update the SAS database"
);
break
;
}
OTDB
::
TreeMaintenance
tm
(
itsOTDBconnection
);
TreeStateConv
tsc
(
itsOTDBconnection
);
tm
.
setTreeState
(
theObs
->
treeID
,
tsc
.
get
(
"queued"
));
break
;
break
;
}
}
...
@@ -468,7 +497,7 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
...
@@ -468,7 +497,7 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
//
//
GCFEvent
::
TResult
MACScheduler
::
finishing_state
(
GCFEvent
&
event
,
GCFPortInterface
&
port
)
GCFEvent
::
TResult
MACScheduler
::
finishing_state
(
GCFEvent
&
event
,
GCFPortInterface
&
port
)
{
{
LOG_DEBUG_STR
(
"finishing_state:"
<<
ev
tstr
(
event
)
<<
"@"
<<
port
.
getName
());
LOG_DEBUG_STR
(
"finishing_state:"
<<
ev
entName
(
event
)
<<
"@"
<<
port
.
getName
());
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
GCFEvent
::
TResult
status
=
GCFEvent
::
HANDLED
;
...
@@ -544,15 +573,27 @@ void MACScheduler::_doOTDBcheck()
...
@@ -544,15 +573,27 @@ void MACScheduler::_doOTDBcheck()
break
;
break
;
}
}
// get current state of Observation
// note: as soon as observation is up it will not show up anymore in the
// SAS list because we changed the state.
// If startup is in progress, it is in the SAS list but also in our admin.
string
cntlrName
=
controllerName
(
CNTLRTYPE_OBSERVATIONCTRL
,
string
cntlrName
=
controllerName
(
CNTLRTYPE_OBSERVATIONCTRL
,
0
,
newTreeList
[
idx
].
treeID
());
0
,
newTreeList
[
idx
].
treeID
());
CTState
cts
;
if
(
_findActiveObservation
(
cntlrName
))
{
CTState
::
CTstateNr
curState
=
itsChildControl
->
getCurrentState
(
cntlrName
);
LOG_DEBUG_STR
(
"Skipping "
<<
cntlrName
);
LOG_DEBUG_STR
(
cntlrName
<<
":cur="
<<
cts
.
name
(
curState
));
idx
++
;
continue
;
}
// get current state of Observation
// CTState cts;
// CTState::CTstateNr curState = itsChildControl->getCurrentState(cntlrName);
// LOG_DEBUG_STR(cntlrName << ":cur=" << cts.name(curState));
// When in startup or claimtime we should try to start the controller.
// When in startup or claimtime we should try to start the controller.
if
((
timediff
>
seconds
(
0
))
&&
(
curState
<
CTState
::
CREATED
))
{
// if ((timediff > seconds(0)) && (curState < CTState::CREATED)) {
// Obs is unknown so try to start it up as long as we didn't reach its starttime.
if
(
timediff
>
seconds
(
0
))
{
// Let database construct the parset for the whole observation
// Let database construct the parset for the whole observation
OTDB
::
TreeMaintenance
tm
(
itsOTDBconnection
);
OTDB
::
TreeMaintenance
tm
(
itsOTDBconnection
);
OTDB
::
treeIDType
treeID
=
newTreeList
[
idx
].
treeID
();
OTDB
::
treeIDType
treeID
=
newTreeList
[
idx
].
treeID
();
...
@@ -579,15 +620,15 @@ void MACScheduler::_doOTDBcheck()
...
@@ -579,15 +620,15 @@ void MACScheduler::_doOTDBcheck()
newObs
.
treeID
=
treeID
;
newObs
.
treeID
=
treeID
;
_addActiveObservation
(
newObs
);
_addActiveObservation
(
newObs
);
LOG_DEBUG_STR
(
"Observation "
<<
cntlrName
<<
" added to active Observations"
);
LOG_DEBUG_STR
(
"Observation "
<<
cntlrName
<<
" added to active Observations"
);
TreeStateConv
tsc
(
itsOTDBconnection
);
tm
.
setTreeState
(
treeID
,
tsc
.
get
(
"queued"
));
}
}
idx
++
;
continue
;
// TODO: due to problems with the PA we only start one obs every cycle.
break
;
// idx++;
// continue;
}
}
#if 0
// in CLAIM period?
// in CLAIM period?
if ((timediff > seconds(0)) && (timediff <= seconds(itsClaimPeriod))) {
if ((timediff > seconds(0)) && (timediff <= seconds(itsClaimPeriod))) {
// Observation is somewhere in the claim period its should be up by now.
// Observation is somewhere in the claim period its should be up by now.
...
@@ -605,7 +646,8 @@ void MACScheduler::_doOTDBcheck()
...
@@ -605,7 +646,8 @@ void MACScheduler::_doOTDBcheck()
// TODO: check if endtime is reached and observation is still running.
// TODO: check if endtime is reached and observation is still running.
idx++;
idx++;
}
#endif
}
// while
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment