Skip to content
Snippets Groups Projects
Commit 4372bb60 authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #3726: Catch exceptions in all StationCU controllers

parent 1042ffd5
No related branches found
No related tags found
No related merge requests found
......@@ -34,16 +34,21 @@ Exception::TerminateHandler t(Exception::terminate);
int main(int argc, char* argv[])
{
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, argv[1]);
try {
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, argv[1]);
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
BeamControl bc(argv[1]);
bc.start(); // make initial transition
BeamControl bc(argv[1]);
bc.start(); // make initial transition
GCFScheduler::instance()->run();
GCFScheduler::instance()->run();
} catch( Exception &ex ) {
LOG_FATAL_STR("Caught exception: " << ex);
return 1;
}
return 0;
}
......
......@@ -34,16 +34,21 @@ Exception::TerminateHandler t(Exception::terminate);
int main(int argc, char* argv[])
{
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, argv[1]);
try {
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, argv[1]);
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
CalibrationControl cc(argv[1]);
cc.start(); // make initial transition
CalibrationControl cc(argv[1]);
cc.start(); // make initial transition
GCFScheduler::instance()->run();
GCFScheduler::instance()->run();
} catch( Exception &ex ) {
LOG_FATAL_STR("Caught exception: " << ex);
return 1;
}
return 0;
}
......
......@@ -39,16 +39,21 @@ int main(int argc, char* argv[])
return (1);
}
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, "ClockControl");
try {
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, "ClockControl");
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
ClockControl cc(argv[1]);
cc.start(); // make initial transition
ClockControl cc(argv[1]);
cc.start(); // make initial transition
GCFScheduler::instance()->run();
GCFScheduler::instance()->run();
} catch( Exception &ex ) {
LOG_FATAL_STR("Caught exception: " << ex);
return 1;
}
return 0;
}
......
......@@ -42,65 +42,70 @@ Exception::TerminateHandler t(Exception::terminate);
int main(int argc, char* argv[])
{
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, "HardwareMonitor");
try {
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, "HardwareMonitor");
LOG_INFO("MACProcessScope: LOFAR_PermSW_HardwareMonitor");
LOG_INFO(Version::getInfo<StationCUVersion>("HardwareMonitor"));
LOG_INFO("MACProcessScope: LOFAR_PermSW_HardwareMonitor");
LOG_INFO(Version::getInfo<StationCUVersion>("HardwareMonitor"));
// for debugging purposes
registerProtocol (RSP_PROTOCOL, RSP_PROTOCOL_STRINGS);
registerProtocol (TBB_PROTOCOL, TBB_PROTOCOL_STRINGS);
registerProtocol (DP_PROTOCOL, DP_PROTOCOL_STRINGS);
// for debugging purposes
registerProtocol (RSP_PROTOCOL, RSP_PROTOCOL_STRINGS);
registerProtocol (TBB_PROTOCOL, TBB_PROTOCOL_STRINGS);
registerProtocol (DP_PROTOCOL, DP_PROTOCOL_STRINGS);
// Create tasks and call initial routines
RSPMonitor* rsp(0);
TBBMonitor* tbb(0);
ECMonitor* ec(0);
// monitor RSP?
if (globalParameterSet()->getUint32("WatchRSPboards",0)) {
rsp = new RSPMonitor("RSPMonitor");
rsp->start();
LOG_INFO("Monitoring the RSP boards");
}
// Create tasks and call initial routines
RSPMonitor* rsp(0);
TBBMonitor* tbb(0);
ECMonitor* ec(0);
// monitor RSP?
if (globalParameterSet()->getUint32("WatchRSPboards",0)) {
rsp = new RSPMonitor("RSPMonitor");
rsp->start();
LOG_INFO("Monitoring the RSP boards");
}
// monitor TBB?
if (globalParameterSet()->getUint32("WatchTBboards",0)) {
tbb = new TBBMonitor("TBBMonitor");
tbb->start();
LOG_INFO("Monitoring the TB boards");
}
// monitor TBB?
if (globalParameterSet()->getUint32("WatchTBboards",0)) {
tbb = new TBBMonitor("TBBMonitor");
tbb->start();
LOG_INFO("Monitoring the TB boards");
}
// monitor EC?
if (globalParameterSet()->getUint32("WatchEnvCntrl",0)) {
ec = new ECMonitor("ECMonitor");
ec->start();
LOG_INFO("Monitoring the Environment Controller");
}
// monitor EC?
if (globalParameterSet()->getUint32("WatchEnvCntrl",0)) {
ec = new ECMonitor("ECMonitor");
ec->start();
LOG_INFO("Monitoring the Environment Controller");
}
// sanity check
if (!tbb && !rsp && !ec) {
LOG_FATAL_STR("Non of the monitortask (WatchRSPboards, WatchTBboards, WatchEnvCntrl) "
"was switched on in the configfile, terminating program");
return (0);
}
// sanity check
if (!tbb && !rsp && !ec) {
LOG_FATAL_STR("Non of the monitortask (WatchRSPboards, WatchTBboards, WatchEnvCntrl) "
"was switched on in the configfile, terminating program");
return (0);
}
// ok, we have something to do, do it.
GCFScheduler::instance()->setDelayedQuit(true); // we need a clean shutdown
GCFScheduler::instance()->run(); // until stop was called
// ok, we have something to do, do it.
GCFScheduler::instance()->setDelayedQuit(true); // we need a clean shutdown
GCFScheduler::instance()->run(); // until stop was called
if (rsp) {
rsp->quit(); // let task quit nicely
}
if (tbb) {
tbb->quit(); // let task quit nicely
}
if (ec) {
ec->quit(); // let task quit nicely
if (rsp) {
rsp->quit(); // let task quit nicely
}
if (tbb) {
tbb->quit(); // let task quit nicely
}
if (ec) {
ec->quit(); // let task quit nicely
}
double postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5);
GCFScheduler::instance()->run(postRunTime); // let processes die.
} catch( Exception &ex ) {
LOG_FATAL_STR("Caught exception: " << ex);
return 1;
}
double postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5);
GCFScheduler::instance()->run(postRunTime); // let processes die.
return (0);
}
......
......@@ -37,26 +37,31 @@ int main(int argc, char* argv[])
{
using LOFAR::basename;
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, basename(argv[0]));
try {
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, basename(argv[0]));
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
ChildControl* cc = ChildControl::instance();
cc->start(); // make initial transition
ChildControl* cc = ChildControl::instance();
cc->start(); // make initial transition
string myName;
if (argc < 2) { // started by swlevel?
myName = myHostname(false) + ":" + basename(argv[0]);
}
else {
myName = argv[1];
}
StationControl sc(myName.c_str());
sc.start(); // make initial transition
string myName;
if (argc < 2) { // started by swlevel?
myName = myHostname(false) + ":" + basename(argv[0]);
}
else {
myName = argv[1];
}
StationControl sc(myName.c_str());
sc.start(); // make initial transition
GCFScheduler::instance()->run();
GCFScheduler::instance()->run();
} catch( Exception &ex ) {
LOG_FATAL_STR("Caught exception: " << ex);
return 1;
}
return 0;
}
......
......@@ -34,17 +34,22 @@ Exception::TerminateHandler t(Exception::terminate);
int main(int argc, char* argv[])
{
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, argv[0]);
GCFScheduler::instance()->disableQueue(); // run as fast as possible
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
TBBControl tc(argv[1]);
tc.start(); // make initial transition
GCFScheduler::instance()->run();
try {
// args: cntlrname, parentHost, parentService
GCFScheduler::instance()->init(argc, argv, argv[0]);
GCFScheduler::instance()->disableQueue(); // run as fast as possible
ParentControl* pc = ParentControl::instance();
pc->start(); // make initial transition
TBBControl tc(argv[1]);
tc.start(); // make initial transition
GCFScheduler::instance()->run();
} catch( Exception &ex ) {
LOG_FATAL_STR("Caught exception: " << ex);
return 1;
}
return 0;
}
......
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