28 #include "toolbox/BSem.h"
30 #include <boost/tokenizer.hpp>
32 #include "xcept/tools.h"
33 #include "xgi/Method.h"
35 #include "cgicc/CgiDefs.h"
36 #include "cgicc/Cgicc.h"
37 #include "cgicc/FormEntry.h"
41 #include <sys/utsname.h>
49 using namespace cgicc;
62 : xdaq::Application(s)
64 , log_(getApplicationLogger())
65 , evtProcessor_(log_, getApplicationDescriptor()->getInstance())
67 , epInitialized_(
false)
69 , autoRestartSlaves_(
false)
70 , slaveRestartDelaySecs_(10)
72 , hasPrescaleService_(
true)
73 , hasModuleWebRegistry_(
true)
74 , hasServiceWebRegistry_(
true)
75 , isRunNumberSetter_(
true)
76 , iDieStatisticsGathering_(
false)
79 , reasonForFailedState_()
80 , squidnet_(3128,
"http://localhost:8000/RELEASE-NOTES.txt")
81 , logRing_(logRingSize_)
82 , logRingIndex_(logRingSize_)
85 , nbSubProcessesReporting_(0)
90 , asReceiveMsgAndExecute_(0)
92 , wlReceivingMonitor_(0)
93 , asReceiveMsgAndRead_(0)
99 , monitorInfoSpace_(0)
100 , monitorLegendaInfoSpace_(0)
101 , applicationInfoSpace_(0)
104 , scalersInfoSpace_(0)
105 , scalersLegendaInfoSpace_(0)
108 , wlScalersActive_(
false)
112 , wlSummarizeActive_(
false)
124 using namespace utils;
126 names_.push_back(
"nbProcessed" );
127 names_.push_back(
"nbAccepted" );
128 names_.push_back(
"epMacroStateInt");
129 names_.push_back(
"epMicroStateInt");
133 LOG4CPLUS_ERROR(getApplicationLogger(),
"Failed to create pipe");
144 getApplicationDescriptor()->getContextDescriptor()->getURL()+
"/"+
145 getApplicationDescriptor()->getURN();
146 class_ =getApplicationDescriptor()->getClassName();
147 instance_=getApplicationDescriptor()->getInstance();
149 LOG4CPLUS_INFO(getApplicationLogger(),
sourceId_ <<
" constructor" );
150 LOG4CPLUS_INFO(getApplicationLogger(),
"CMSSW_BASE:"<<getenv(
"CMSSW_BASE"));
152 getApplicationDescriptor()->setAttribute(
"icon",
"/evf/images/epicon.jpg");
154 xdata::InfoSpace *ispace = getApplicationInfoSpace();
161 ispace->fireItemAvailable(
"runNumber", &
runNumber_ );
162 ispace->fireItemAvailable(
"outputEnabled", &
outPut_ );
164 ispace->fireItemAvailable(
"hasSharedMemory", &
hasShMem_);
177 ispace->fireItemAvailable(
"iDieUrl", &
iDieUrl_ );
180 getApplicationInfoSpace()->addItemChangedListener(
"parameterSet",
this);
181 getApplicationInfoSpace()->addItemChangedListener(
"outputEnabled",
this);
188 std::string monInfoSpaceName=
"evf-eventprocessor-status-monitor";
189 toolbox::net::URN urn = this->createQualifiedInfoSpace(monInfoSpaceName);
192 std::string monLegendaInfoSpaceName=
"evf-eventprocessor-status-legenda";
193 urn = this->createQualifiedInfoSpace(monLegendaInfoSpaceName);
205 std::string scalersInfoSpaceName=
"evf-eventprocessor-scalers-monitor";
206 urn = this->createQualifiedInfoSpace(scalersInfoSpaceName);
209 std::string scalersLegendaInfoSpaceName=
"evf-eventprocessor-scalers-legenda";
210 urn = this->createQualifiedInfoSpace(scalersLegendaInfoSpaceName);
244 LOG4CPLUS_DEBUG(getApplicationLogger(),
245 "Trying to create message service presence ");
251 LOG4CPLUS_ERROR(getApplicationLogger(),
252 "Unable to create message service presence ");
256 LOG4CPLUS_ERROR(getApplicationLogger(),
"Unknown Exception");
260 typedef std::set<xdaq::ApplicationDescriptor*> AppDescSet_t;
261 typedef AppDescSet_t::iterator AppDescIter_t;
264 getApplicationContext()->getDefaultZone()->
265 getApplicationDescriptors(
"RCMSStateListener");
268 LOG4CPLUS_WARN(getApplicationLogger(),
269 "MonitorReceiver not found, perhaphs it has not been defined ? Scalers updater wl will bail out!");
274 AppDescIter_t it = rcms.begin();
288 AppDescSet_t setOfiDie=
289 getApplicationContext()->getDefaultZone()->
290 getApplicationDescriptors(
"evf::iDie");
292 for (AppDescIter_t it=setOfiDie.begin();it!=setOfiDie.end();++it)
293 if ((*it)->getInstance()==0)
294 iDieUrl_ = (*it)->getContextDescriptor()->getURL() +
"/" + (*it)->getURN();
344 LOG4CPLUS_INFO(getApplicationLogger(),
"Start configuring ...");
363 std::string slegenda = ((xdata::String*)legenda)->value_;
369 LOG4CPLUS_INFO(getApplicationLogger(),
"coud not send legenda"
375 LOG4CPLUS_INFO(getApplicationLogger(),
"Finished configuring!");
376 localLog(
"-I- Configuration completed");
424 LOG4CPLUS_INFO(getApplicationLogger(),
"Start enabling...");
440 std::string slegenda = ((xdata::String*)legenda)->value_;
445 LOG4CPLUS_INFO(getApplicationLogger(),
"coud not send legenda"
470 retval =
subs_[
i].forkNew();
477 int retval = pthread_mutex_destroy(&
stop_lock_);
478 if(retval != 0) perror(
"error");
480 if(retval != 0) perror(
"error");
490 LOG4CPLUS_INFO(getApplicationLogger(),
"Finished enabling!");
510 LOG4CPLUS_INFO(getApplicationLogger(),
"Start halting ...");
523 LOG4CPLUS_INFO(getApplicationLogger(),
"Finished halting!");
543 if (e.type()==
"ItemChangedEvent" &&
fsm_.
stateName()->toString()!=
"Halted") {
544 std::string item =
dynamic_cast<xdata::ItemChangedEvent&
>(e).itemName();
546 if ( item ==
"parameterSet") {
547 LOG4CPLUS_WARN(getApplicationLogger(),
548 "HLT Menu changed, force reinitialization of EventProcessor");
551 if ( item ==
"outputEnabled") {
553 LOG4CPLUS_WARN(getApplicationLogger(),
554 (
outprev_ ?
"Disabling " :
"Enabling ")<<
"global output");
559 if (item ==
"globalInputPrescale") {
560 LOG4CPLUS_WARN(getApplicationLogger(),
561 "Setting global input prescale has no effect "
562 <<
"in this version of the code");
564 if ( item ==
"globalOutputPrescale") {
565 LOG4CPLUS_WARN(getApplicationLogger(),
566 "Setting global output prescale has no effect "
567 <<
"in this version of the code");
576 using namespace cgicc;
578 std::ostringstream ost;
583 for(
std::map<std::string, std::string, std::less<std::string> >::iterator mit =
584 mycgi->getEnvironment().begin();
585 mit != mycgi->getEnvironment().end(); mit++)
586 ost << mit->first <<
"%" << mit->second <<
";";
587 std::vector<FormEntry>
els = cgi.getElements() ;
588 std::vector<FormEntry> el1;
589 cgi.getElement(
"method",el1);
590 std::vector<FormEntry> el2;
591 cgi.getElement(
"process",el2);
593 std::string meth = el1[0].getValue();
596 std::string
mod = el2[0].getValue();
597 pid = atoi(mod.c_str());
598 for(; i <
subs_.size(); i++)
601 *out <<
"ERROR 404 : Process " <<
pid <<
" Not Found !" << std::endl;
604 if(
subs_[i].alive() != 1){
605 *out <<
"ERROR 405 : Process " <<
pid <<
" Not Alive !" << std::endl;
609 strcpy(msg1->mtext,meth.c_str());
610 strcpy(msg1->mtext+meth.length(),ost.str().c_str());
612 unsigned int keep_supersleep_original_value =
superSleepSec_.value_;
616 std::vector<char *>
pieces;
618 unsigned long retval1 =
subs_[
i].rcvNonBlocking(msg,
true);
623 unsigned int nbytes = atoi(msg->mtext);
625 char *buf=
new char[nbytes];
628 <<
"CAREFUL HERE, read less bytes than expected from pipe in subWeb" << std::endl;
629 pieces.push_back(buf);
632 for(
unsigned int j = 0;
j < pieces.size();
j++){
647 *
out <<
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"
648 <<
"<html><head><title>" << getApplicationDescriptor()->getClassName() << (
nbSubProcesses_.value_ > 0 ?
"MP " :
" ")
649 << getApplicationDescriptor()->getInstance() <<
"</title>"
650 <<
"<meta http-equiv=\"REFRESH\" content=\"0;url=/evf/html/defaultBasePage.html\">"
662 std::string urn = getApplicationDescriptor()->getURN();
664 *
out <<
"<!-- base href=\"/" << urn
665 <<
"\"> -->" << std::endl;
666 *
out <<
"<html>" << std::endl;
667 *
out <<
"<head>" << std::endl;
668 *
out <<
"<link type=\"text/css\" rel=\"stylesheet\"";
669 *
out <<
" href=\"/evf/html/styles.css\"/>" << std::endl;
670 *
out <<
"<title>" << getApplicationDescriptor()->getClassName()
671 << getApplicationDescriptor()->getInstance()
672 <<
" MAIN</title>" << std::endl;
673 *
out <<
"</head>" << std::endl;
674 *
out <<
"<body>" << std::endl;
675 *
out <<
"<table border=\"0\" width=\"100%\">" << std::endl;
676 *
out <<
"<tr>" << std::endl;
677 *
out <<
" <td align=\"left\">" << std::endl;
678 *
out <<
" <img" << std::endl;
679 *
out <<
" align=\"middle\"" << std::endl;
680 *
out <<
" src=\"/evf/images/spoticon.jpg\"" << std::endl;
681 *
out <<
" alt=\"main\"" << std::endl;
682 *
out <<
" width=\"64\"" << std::endl;
683 *
out <<
" height=\"64\"" << std::endl;
684 *
out <<
" border=\"\"/>" << std::endl;
685 *
out <<
" <b>" << std::endl;
686 *
out << getApplicationDescriptor()->getClassName()
687 << getApplicationDescriptor()->getInstance() << std::endl;
689 *
out <<
" </b>" << std::endl;
690 *
out <<
" </td>" << std::endl;
691 *
out <<
" <td width=\"32\">" << std::endl;
692 *
out <<
" <a href=\"/urn:xdaq-application:lid=3\">" << std::endl;
693 *
out <<
" <img" << std::endl;
694 *
out <<
" align=\"middle\"" << std::endl;
695 *
out <<
" src=\"/hyperdaq/images/HyperDAQ.jpg\"" << std::endl;
696 *
out <<
" alt=\"HyperDAQ\"" << std::endl;
697 *
out <<
" width=\"32\"" << std::endl;
698 *
out <<
" height=\"32\"" << std::endl;
699 *
out <<
" border=\"\"/>" << std::endl;
700 *
out <<
" </a>" << std::endl;
701 *
out <<
" </td>" << std::endl;
702 *
out <<
" <td width=\"32\">" << std::endl;
703 *
out <<
" </td>" << std::endl;
704 *
out <<
" <td width=\"32\">" << std::endl;
705 *
out <<
" <a href=\"/" << urn <<
"/\">" << std::endl;
706 *
out <<
" <img" << std::endl;
707 *
out <<
" align=\"middle\"" << std::endl;
708 *
out <<
" src=\"/evf/images/epicon.jpg\"" << std::endl;
709 *
out <<
" alt=\"main\"" << std::endl;
710 *
out <<
" width=\"32\"" << std::endl;
711 *
out <<
" height=\"32\"" << std::endl;
712 *
out <<
" border=\"\"/>" << std::endl;
713 *
out <<
" </a>" << std::endl;
714 *
out <<
" </td>" << std::endl;
715 *
out <<
"</tr>" << std::endl;
716 *
out <<
"</table>" << std::endl;
718 *
out <<
"<hr/>" << std::endl;
720 std::ostringstream ost;
722 ost <<
"/SubWeb?process=" << getpid() <<
"&method=moduleWeb&";
724 ost <<
"/moduleWeb?";
731 *
out <<
"<td>HLT Unconfigured</td>" << std::endl;
732 *
out <<
"</table>" << std::endl;
734 *
out <<
"<br><textarea rows=" << 10 <<
" cols=80 scroll=yes>" << std::endl;
736 *
out <<
"</textarea><P>" << std::endl;
738 *
out <<
"</body>" << std::endl;
739 *
out <<
"</html>" << std::endl;
747 out->getHTTPResponseHeader().addHeader(
"Content-Type",
748 "application/octet-stream" );
749 out->getHTTPResponseHeader().addHeader(
"Content-Transfer-Encoding",
763 std::string slegenda = ((xdata::String*)legenda)->value_;
764 *
out << slegenda << std::endl;
777 if (!success) errmsg =
"Failed to attach DQM service to shared memory";
780 errmsg =
"Failed to attach DQM service to shared memory: " + (std::string)e.
what();
795 if (!success) errmsg =
"Failed to detach DQM service from shared memory";
798 errmsg =
"Failed to detach DQM service from shared memory: " + (std::string)e.
what();
806 std::ostringstream oss;
826 tm *uptm = localtime(&tv.tv_sec);
827 char datestring[256];
828 strftime(datestring,
sizeof(datestring),
"%c", uptm);
833 timestamp <<
" at " << datestring;
834 m += timestamp.str();
842 toolbox::task::getWorkLoopFactory()->getWorkLoop(
"Supervisor",
851 std::string
msg =
"Failed to start workloop 'Supervisor'.";
860 toolbox::task::getWorkLoopFactory()->getWorkLoop(
"Receiving",
869 std::string
msg =
"Failed to start workloop 'Receiving'.";
877 toolbox::task::getWorkLoopFactory()->getWorkLoop(
"ReceivingM",
888 std::string
msg =
"Failed to start workloop 'ReceivingM'.";
903 LOG4CPLUS_DEBUG(getApplicationLogger(),
904 "Trying to create message service presence ");
910 LOG4CPLUS_ERROR(getApplicationLogger(),
911 "Unable to create message service presence ");
915 LOG4CPLUS_ERROR(getApplicationLogger(),
"Unknown Exception");
948 for(
unsigned int i = 0;
i <
subs_.size();
i++)
950 if(
subs_[
i].alive()==-1000)
continue;
953 pid_t killedOrNot = waitpid(
subs_[
i].
pid(),&sl,WNOHANG);
955 if(killedOrNot==
subs_[
i].
pid())
subs_[
i].setStatus((WIFEXITED(sl) != 0 ? 0 : -1));
958 std::ostringstream ost;
959 if(
subs_[
i].alive()==0) ost <<
" process exited with status " << WEXITSTATUS(sl);
960 else if(WIFSIGNALED(sl)!=0) ost <<
" process terminated with signal " << WTERMSIG(sl);
961 else ost <<
" process stopped ";
963 subs_[
i].setReasonForFailed(ost.str());
966 std::ostringstream ost1;
967 ost1 <<
"-E- Slave " <<
subs_[
i].pid() << ost.str();
973 if(stopping)
return true;
981 for(
unsigned int i = 0;
i <
subs_.size();
i++)
983 if(
subs_[
i].alive() != 1){
984 if(
subs_[
i].countdown() == 0)
986 if(
subs_[
i].restartCount()>2){
987 LOG4CPLUS_WARN(getApplicationLogger(),
" Not restarting subprocess in slot " <<
i
988 <<
" - maximum restart count reached");
989 std::ostringstream ost1;
990 ost1 <<
"-W- Dead Process in slot " <<
i <<
" reached maximum restart count";
994 sentinelException, ost1.str());
995 notifyQualified(
"error",sentinelException);
999 subs_[
i].restartCount()++;
1000 pid_t rr =
subs_[
i].forkNew();
1005 int retval = pthread_mutex_destroy(&
stop_lock_);
1006 if(retval != 0) perror(
"error");
1008 if(retval != 0) perror(
"error");
1016 ((xdata::UnsignedInteger32*)(lsid))->value_--;
1020 std::cout <<
"trouble with lsindex during restart" << std::endl;
1025 ((xdata::Boolean*)(lstb))->value_ =
false;
1029 std::cout <<
"trouble with resetting flag for eol recovery " << std::endl;
1039 std::ostringstream ost1;
1040 ost1 <<
"-I- New Process " << rr <<
" forked for slot " <<
i;
1050 xdata::Serializable *lsid = 0;
1051 xdata::Serializable *psid = 0;
1052 xdata::Serializable *epMAltState = 0;
1053 xdata::Serializable *epmAltState = 0;
1054 xdata::Serializable *dqmp = 0;
1055 xdata::UnsignedInteger32 *dqm = 0;
1070 LOG4CPLUS_INFO(getApplicationLogger(),
"could not retrieve some data - " << e.what());
1076 xdata::UnsignedInteger32*nbp = ((xdata::UnsignedInteger32*)
nbProcessed);
1077 xdata::UnsignedInteger32*nba = ((xdata::UnsignedInteger32*)
nbAccepted);
1078 xdata::UnsignedInteger32*
ls = ((xdata::UnsignedInteger32*)lsid);
1079 xdata::UnsignedInteger32*ps = ((xdata::UnsignedInteger32*)psid);
1081 dqm = (xdata::UnsignedInteger32*)dqmp;
1082 if(dqm) dqm->value_ = 0;
1090 for(
unsigned int i = 0;
i <
subs_.size();
i++)
1105 if(!
subs_[
i].inInconsistentState() &&
1110 std::ostringstream ost;
1111 ost <<
"edm::eventprocessor slot " <<
i <<
" process id "
1112 <<
subs_[
i].pid() <<
" not in Running state : Mstate="
1115 <<
" - Look into possible error messages from HLT process";
1116 LOG4CPLUS_WARN(getApplicationLogger(),ost.str());
1118 nbp->value_ +=
subs_[
i].params().nbp;
1119 nba->value_ +=
subs_[
i].params().nba;
1120 if(dqm)dqm->value_ += p->
dqm;
1123 if(p->
ls > ls->value_) ls->value_ = p->
ls;
1124 if(p->
ps != ps->value_) ps->value_ = p->
ps;
1127 nbp->value_ +=
subs_[
i].get_save_nbp();
1128 nba->value_ +=
subs_[
i].get_save_nba();
1132 LOG4CPLUS_INFO(getApplicationLogger(),
1133 "could not send/receive msg on slot "
1134 <<
i <<
" - " << e.what());
1140 nbp->value_ +=
subs_[
i].get_save_nbp();
1141 nba->value_ +=
subs_[
i].get_save_nba();
1146 for(
unsigned int i = 0;
i <
subs_.size();
i++)
1148 if(
subs_[
i].params().nbp == 0){
1152 subs_[
i].found_invalid();
1153 if(
subs_[
i].nfound_invalid() > 60){
1155 subs_[
i].post(msg3,
false);
1156 std::ostringstream ost1;
1157 ost1 <<
"-W- Process in slot " <<
i <<
" Never reached the running state - forcestopping it";
1159 LOG4CPLUS_ERROR(getApplicationLogger(),ost1.str());
1161 sentinelException, ost1.str());
1162 notifyQualified(
"error",sentinelException);
1172 LOG4CPLUS_INFO(getApplicationLogger(),
"std exception - " << e.what());
1175 LOG4CPLUS_INFO(getApplicationLogger(),
"unknown exception ");
1179 for(
unsigned int i = 0;
i <
subs_.size();
i++)
1181 if(
subs_[
i].alive()==-1000)
1195 LOG4CPLUS_ERROR(
log_,
"Exception from fireItemGroupChanged: " << e.what());
1206 toolbox::task::getWorkLoopFactory()->getWorkLoop(
"Scalers",
1216 std::string
msg =
"Failed to start workloop 'Scalers'.";
1227 toolbox::task::getWorkLoopFactory()->getWorkLoop(
"Summary",
1238 std::string
msg =
"Failed to start workloop 'Summarize'.";
1256 std::cout << getpid()<<
" Scalers workloop, bailing out, no evtProcessor " << std::endl;
1264 if(ret!=0)
std::cout <<
"scalers workloop, error posting to sqs_ " << errno << std::endl;
1276 bool atLeastOneProcessUpdatedSuccessfully =
false;
1278 for (
unsigned int i = 0;
i <
subs_.size();
i++)
1290 bool insync =
false;
1291 bool exception_caught =
false;
1299 <<
" " <<
subs_[
i].alive() <<
" " << strerror(errno) << std::endl;
1300 exception_caught =
true;
1311 if(exception_caught)
continue;
1321 atLeastOneProcessUpdatedSuccessfully =
true;
1325 else std::cout <<
"msgrcv returned error " << errno << std::endl;
1328 if(atLeastOneProcessUpdatedSuccessfully){
1334 LOG4CPLUS_WARN(getApplicationLogger(),
"Summarize loop: no process updated successfully - sleep 10 seconds before trying again");
1351 LOG4CPLUS_INFO(getApplicationLogger(),
"coud not send statistics"
1373 strncpy(msg1->mtext,out.str().c_str(),out.str().size());
1380 xdata::Serializable *dqmp = 0;
1381 xdata::UnsignedInteger32 *dqm = 0;
1387 dqm = (xdata::UnsignedInteger32*)dqmp;
1398 if(dqm) data->
dqm = dqm->value_;
else data->
dqm = 0;
1408 bool running =
true;
1411 int retval = pthread_mutex_lock(&
stop_lock_);
1412 if(retval != 0) perror(
"error");
1414 if(count>5) _exit(-1);
1416 if(running) {
::sleep(1); count++;}
1428 unsigned int bytesToSend = 0;
1431 size_t pos = query.find_first_of(
"&");
1434 if(pos!=std::string::npos)
1436 method = query.substr(0,pos);
1437 args = query.substr(pos+1,query.length()-pos-1);
1442 if(method==
"Spotlight")
1446 else if(method==
"procStat")
1450 else if(method==
"moduleWeb")
1453 boost::char_separator<char> sep(
";");
1454 boost::tokenizer<boost::char_separator<char> >
tokens(args, sep);
1455 for (
boost::tokenizer<boost::char_separator<char> >::iterator tok_iter = tokens.begin();
1456 tok_iter != tokens.end(); ++tok_iter){
1457 size_t pos = (*tok_iter).find_first_of(
"%");
1458 if(pos != std::string::npos){
1459 std::string
first = (*tok_iter).substr(0 , pos);
1460 std::string
second = (*tok_iter).substr(pos+1, (*tok_iter).length()-pos-1);
1466 else if(method==
"Default")
1472 out <<
"Error 404!!!!!!!!" << std::endl;
1476 bytesToSend = out.str().size();
1477 unsigned int cycle = 0;
1483 while(bytesToSend !=0){
1490 bytesToSend -= msgSize;
1539 std::ostringstream oss;
1540 oss<<
"EventProcessor::runAsync returned status code " << sc;
1557 std::cout <<
"exception " << (std::string)e.what() << std::endl;
1568 LOG4CPLUS_INFO(getApplicationLogger(),
"waiting for edm::EventProcessor to start before enabling watchdog");
1591 LOG4CPLUS_DEBUG(getApplicationLogger(),
1592 "Trying to create message service presence ");
1598 LOG4CPLUS_ERROR(getApplicationLogger(),
1599 "Unable to create message service presence ");
1603 LOG4CPLUS_ERROR(getApplicationLogger(),
"Unknown Exception");
1623 LOG4CPLUS_INFO(getApplicationLogger(),
"Start stopping :) ...");
1644 LOG4CPLUS_INFO(getApplicationLogger(),
"Finished stopping!");
1655 for(
unsigned int i = 0;
i <
subs_.size();
i++)
1659 processes_to_stop[
i] =
true;
1660 subs_[
i].post(msg,
false);
1664 for(
unsigned int i = 0;
i <
subs_.size();
i++)
1667 if(processes_to_stop[
i]){
1669 subs_[
i].rcv(msg1,
false);
1672 std::ostringstream ost;
1673 ost <<
"failed to get STOP - errno ->" << errno <<
" " << e.what();
1687 while(
subs_[i].alive()>0) ::usleep(10000);
1696 std::string urn = getApplicationDescriptor()->getURN();
1700 if(
myProcess_) {
std::cout <<
"microstate called for child! bail out" << std::endl;
return;}
1702 <<
"</td><td>"<< (
myProcess_ ?
"S" :
"M") <<
"</td><td>" <<
nblive_ <<
"</td><td>"
1703 <<
nbdead_ <<
"</td><td><a href=\"/" << urn <<
"/procStat\">" << getpid() <<
"</a></td>";
1710 for(
unsigned int i = 0;
i <
subs_.size();
i++)
1715 *out <<
"<tr><td bgcolor=\"#00FF00\" id=\"a"
1716 <<
i <<
"\">""Alive</td><td>S</td><td>"
1717 <<
subs_[
i].queueId() <<
"<td>"
1718 <<
subs_[
i].queueStatus()<<
"/"
1719 <<
subs_[
i].queueOccupancy() <<
"/"
1720 <<
subs_[
i].queuePidOfLastSend() <<
"/"
1721 <<
subs_[
i].queuePidOfLastReceive()
1722 <<
"</td><td><a id=\"p"<<
i <<
"\" href=\"SubWeb?process="
1723 <<
subs_[
i].pid() <<
"&method=procStat\">"
1724 <<
subs_[
i].pid()<<
"</a></td>"
1727 <<
subs_[
i].params().nba <<
"/" <<
subs_[
i].params().nbp
1728 <<
" (" << float(
subs_[
i].params().nba)/float(
subs_[
i].params().nbp)*100. <<
"%)"
1729 <<
"</td><td>" <<
subs_[
i].params().ls <<
"/" <<
subs_[
i].params().ls
1730 <<
"</td><td>" <<
subs_[
i].params().ps
1732 << ((
subs_[
i].params().eols<
subs_[
i].params().ls) ?
" bgcolor=\"#00FF00\"" :
" bgcolor=\"#FF0000\"") <<
">"
1733 <<
subs_[
i].params().eols
1734 <<
"</td><td>" <<
subs_[
i].params().dqm
1735 <<
"</td><td>" <<
subs_[
i].params().trp <<
"</td>";
1740 *out <<
"<tr><td id=\"a"<<
i <<
"\" ";
1741 if(
subs_[i].alive()==-1000)
1742 *out <<
" bgcolor=\"#bbaabb\">NotInitialized";
1744 *out << (
subs_[
i].alive()==0 ?
">Done" :
" bgcolor=\"#FF0000\">Dead");
1745 *out <<
"</td><td>S</td><td>"<<
subs_[
i].queueId() <<
"<td>"
1746 <<
subs_[
i].queueStatus() <<
"/"
1747 <<
subs_[
i].queueOccupancy() <<
"/"
1748 <<
subs_[
i].queuePidOfLastSend() <<
"/"
1749 <<
subs_[
i].queuePidOfLastReceive()
1750 <<
"</td><td id=\"p"<< i <<
"\">"
1751 <<
subs_[
i].pid()<<
"</td><td colspan=\"5\">" <<
subs_[
i].reasonForFailed();
1752 if(
subs_[i].alive()!=0 &&
subs_[i].alive()!=-1000)
1755 *out <<
" will restart in " <<
subs_[
i].countdown() <<
" s";
1757 *out <<
" reached maximum restart count";
1758 else *out <<
" autoRestart is disabled ";
1762 " bgcolor=\"#00FF00\"" :
" bgcolor=\"#FF0000\"")
1764 <<
subs_[
i].params().eols
1765 <<
"</td><td>" <<
subs_[
i].params().dqm
1766 <<
"</td><td>" <<
subs_[
i].params().trp <<
"</td>";
1772 *out <<
"<tr><td id=\"a"<<
i <<
"\" "
1773 <<
"bgcolor=\"#FFFF00\">NotResp</td><td>S</td><td>"<<
subs_[
i].queueId() <<
"<td>"
1774 <<
subs_[
i].queueStatus() <<
"/"
1775 <<
subs_[
i].queueOccupancy() <<
"/"
1776 <<
subs_[
i].queuePidOfLastSend() <<
"/"
1777 <<
subs_[
i].queuePidOfLastReceive()
1778 <<
"</td><td id=\"p"<<
i <<
"\">"
1779 <<
subs_[
i].pid()<<
"</td>";
1787 LOG4CPLUS_INFO(getApplicationLogger(),
"evf::Exception caught in microstate - " << e.what());
1791 LOG4CPLUS_INFO(getApplicationLogger(),
"cms::Exception caught in microstate - " << e.
what());
1795 LOG4CPLUS_INFO(getApplicationLogger(),
"std::Exception caught in microstate - " << e.what());
1799 LOG4CPLUS_INFO(getApplicationLogger(),
"unknown exception caught in microstate - ");
1807 using namespace utils;
1818 *out << getApplicationDescriptor()->getClassName()
1821 mDiv(out,
"in",getApplicationDescriptor()->getInstance());
1824 *out <<
"<a href=\"" <<
configString_.toString() <<
"\">HLT Config</a>";
1829 mDiv(out,
"hlt",
"Not yet...");
1851 mDiv(out,
"vpi",(
unsigned int)
vp_);
1853 mDiv(out,
"vul",
"Prowling");
1855 mDiv(out,
"vul",
"Dead");
1888 using namespace utils;
1889 std::ostringstream ost;
1898 xdata::Serializable *monsleep = 0;
1899 xdata::Serializable *lstimeout = 0;
1908 mDiv(&ost,
"ms",monsleep->toString());
1910 mDiv(&ost,
"lst",lstimeout->toString());
1911 char cbuf[
sizeof(
struct utsname)];
1912 struct utsname* buf = (
struct utsname*)cbuf;
1914 mDiv(&ost,
"sysinfo");
1915 ost << buf->sysname <<
" " << buf->nodename
1916 <<
" " << buf->release <<
" " << buf->version <<
" " << buf->machine;
xdata::Boolean hasModuleWebRegistry_
static const char runNumber_[]
virtual char const * what() const
void summaryWebPage(xgi::Input *, xgi::Output *, const std::string &)
unsigned long rcvSlave(MsgBuf &ptr, bool isMonitor)
void spotlightWebPage(xgi::Input *, xgi::Output *)
xdata::Vector< xdata::Integer > spMStates_
xoap::MessageReference commandCallback(xoap::MessageReference msg)
xdata::InfoSpace * monitorInfoSpace_
void subWeb(xgi::Input *in, xgi::Output *out)
event_processor::State getState() const
void stopSlavesAndAcknowledge()
std::vector< std::string > logRing_
bool receivingAndMonitor(toolbox::task::WorkLoop *wl)
xdata::UnsignedInteger32 slaveRestartDelaySecs_
void startSummarizeWorkLoop()
void updateRollingReport()
xdata::UnsignedInteger32 runNumber_
void startScalersWorkLoop()
#define MSGQ_MESSAGE_TYPE_RANGE
void updater(xgi::Input *in, xgi::Output *out)
toolbox::task::WorkLoop * wlScalers_
pthread_mutex_t start_lock_
xdata::Integer epmAltState_
std::map< std::string, std::string, std::less< std::string > > & getEnvironment()
#define MSQS_MESSAGE_TYPE_TRR
void startMonitoringWorkLoop()
virtual std::string explainSelf() const
void taskWebPage(xgi::Input *, xgi::Output *, const std::string &)
void startReceivingLoop()
FWEPWrapper evtProcessor_
xdata::Boolean isRunNumberSetter_
void setAppCtxt(xdaq::ApplicationContext *ctx)
MsgBuf slave_message_monitoring_
xdata::Boolean hasServiceWebRegistry_
void clearCounters()
Clears counters used by trigger report.
toolbox::task::WorkLoop * wlReceiving_
boost::tokenizer< boost::char_separator< char > > tokenizer
void init(unsigned short, std::string &)
MsgBuf & getPackedTriggerReport()
#define MSQM_MESSAGE_TYPE_FSTOP
toolbox::task::ActionSignature * asReceiveMsgAndExecute_
void startSupervisorLoop()
void procStat(std::ostringstream *out)
xdata::InfoSpace * scalersLegendaInfoSpace_
toolbox::task::ActionSignature * asSupervisor_
void setRunNumber(RunNumber_t runNumber)
xdata::Boolean autoRestartSlaves_
std::string const & moduleNameFromIndex(unsigned int i) const
xdata::UnsignedInteger32 nbSubProcessesReporting_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void forceInitEventProcessorMaybe()
void css(xgi::Input *in, xgi::Output *out)
void cDiv(std::ostringstream *out)
toolbox::task::ActionSignature * asReceiveMsgAndRead_
MsgBuf master_message_prr_
xdata::Boolean exitOnError_
std::vector< SubProcess > subs_
xdata::InfoSpace * monitorLegendaInfoSpace_
bool summarize(toolbox::task::WorkLoop *wl)
xdata::Serializable * nbProcessed
xoap::MessageReference fsmCallback(xoap::MessageReference msg)
U second(std::pair< T, U > const &p)
std::string wlMonitoring()
#define MSQM_MESSAGE_TYPE_PRG
xdata::Bag< xdaq2rc::ClassnameAndInstance > * rcmsStateListener()
void fireFailed(const std::string &errorMsg, void *originator)
#define MSQS_MESSAGE_TYPE_WEB
void adjustLsIndexForRestart()
bool halting(toolbox::task::WorkLoop *wl)
#define MSQS_MESSAGE_TYPE_STOP
#define MSQS_MESSAGE_TYPE_PRR
bool scalers(toolbox::task::WorkLoop *wl)
MsgBuf master_message_trr_
toolbox::task::WorkLoop * wlSupervising_
void declareRunNumber(RunNumber_t runNumber)
static void setAppl(xdaq::Application *app)
std::string reasonForFailedState_
void resetLumiSectionReferenceIndex()
bool monitoring(toolbox::task::WorkLoop *wl)
FUEventProcessor(xdaq::ApplicationStub *s)
int postSlave(MsgBuf &ptr, bool isMonitor)
std::string logsAsString()
xdata::Boolean iDieStatisticsGathering_
int start(std::string, int=0)
void setAppDesc(xdaq::ApplicationDescriptor *ad)
uint16_t mem[nChs][nEvts]
void scalersWeb(xgi::Input *, xgi::Output *)
void resetPackedTriggerReport()
xdata::Boolean squidPresent_
std::list< std::string > names_
void setScalersInfoSpace(xdata::InfoSpace *sis, xdata::InfoSpace *slis)
void sendStat(unsigned int)
xdata::Boolean hasPrescaleService_
#define NUMERIC_MESSAGE_SIZE
unsigned int getNumberOfMicrostates()
MsgBuf slave_message_prr_
bool receiving(toolbox::task::WorkLoop *wl)
bool stopping(toolbox::task::WorkLoop *wl)
void procStat(xgi::Input *in, xgi::Output *out)
toolbox::task::WorkLoop * wlSummarize_
virtual ~FUEventProcessor()
void fireEvent(const std::string &evtType, void *originator)
xdata::Serializable * nbAccepted
void disableRcmsStateNotification()
std::string getReleaseVersion()
void startReceivingMonitorLoop()
#define MSQM_MESSAGE_TYPE_TRP
void localLog(std::string)
static PresenceFactory * get()
#define MSQS_MESSAGE_TYPE_MCR
void setMonitorInfoSpace(xdata::InfoSpace *mis, xdata::InfoSpace *mlis)
bool configuring(toolbox::task::WorkLoop *wl)
int notstarted_state_code() const
xdata::InfoSpace * applicationInfoSpace_
edm::EventProcessor::StatusCode stop()
xdata::UnsignedInteger32 nbSubProcesses_
bool enabling(toolbox::task::WorkLoop *wl)
std::auto_ptr< Presence > makePresence(std::string const &presence_type) const
xdata::String * stateName()
StatusCode statusAsync() const
void setApplicationInfoSpace(xdata::InfoSpace *is)
unsigned int getLumiSectionReferenceIndex()
bool getTriggerReport(bool useLock)
unsigned int scalersUpdates_
xdata::String configString_
xdata::Boolean * foundRcmsStateListener()
std::vector< std::string > const & getmicromap() const
xdata::UnsignedInteger32 superSleepSec_
xdata::UnsignedInteger32 lastLumiUsingEol_
std::string const & stateNameFromIndex(unsigned int i) const
void sendMessageOverMonitorQueue(MsgBuf &)
void moduleWeb(xgi::Input *in, xgi::Output *out)
std::string const & configuration() const
std::string configuration_
#define MSQM_MESSAGE_TYPE_STOP
void pathNames(xgi::Input *, xgi::Output *)
std::string updaterStatic_
void sendLegenda(const std::vector< std::string > &)
pthread_mutex_t pickup_lock_
void defaultWebPage(xgi::Input *in, xgi::Output *out)
toolbox::task::ActionSignature * asSummarize_
xdata::Vector< xdata::Integer > spmStates_
void sendLegenda(const std::string &)
xdata::Integer epMAltState_
xdata::UnsignedInteger32 instance_
void serviceWeb(xgi::Input *in, xgi::Output *out)
#define MSQM_MESSAGE_TYPE_MCS
void mDiv(std::ostringstream *out, std::string name)
toolbox::task::WorkLoop * wlReceivingMonitor_
void withdrawLumiSectionIncrement()
#define MSQM_MESSAGE_TYPE_WEB
void microState(xgi::Input *in, xgi::Output *out)
void sumAndPackTriggerReport(MsgBuf &buf)
toolbox::task::ActionSignature * asScalers_
bool supervisor(toolbox::task::WorkLoop *wl)
TriggerReportStatic * getPackedTriggerReportAsStruct()
#define MAX_PIPE_BUFFER_SIZE
MsgBuf master_message_prg_
T mod(const T &a, const T &b)
int totalEventsPassed() const
pthread_mutex_t stop_lock_
unsigned int getScalersUpdates()
void uptime(std::ostringstream *out)
void publishConfigAndMonitorItems(bool)
unsigned int logRingIndex_
xdata::InfoSpace * scalersInfoSpace_
void sendStat(const unsigned char *, size_t, unsigned int)
void actionPerformed(xdata::Event &e)
void microState(xgi::Input *in, xgi::Output *out)
void setRcms(xdaq::ApplicationDescriptor *rcms)
static const unsigned int logRingSize_
xdata::Boolean epInitialized_
void findRcmsStateListener()
void enableEndPaths(bool active)