CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWEPWrapper.cc
Go to the documentation of this file.
1 #include "FWEPWrapper.h"
2 
10 
12 
13 #include "toolbox/task/WorkLoopFactory.h"
14 #include "xdaq/ApplicationDescriptorImpl.h"
15 #include "xdaq/ContextDescriptor.h"
16 #include "xdaq/ApplicationContext.h"
17 #include "xdata/Boolean.h"
18 #include "xdata/TableIterator.h"
19 #include "xdata/exdr/Serializer.h"
20 #include "xdata/exdr/AutoSizeOutputStreamBuffer.h"
21 
23 #undef HAVE_STAT
30 
32 
33 
34 #include "xoap/MessageFactory.h"
35 #include "xoap/SOAPEnvelope.h"
36 #include "xoap/SOAPBody.h"
37 #include "xoap/domutils.h"
38 #include "xoap/Method.h"
39 #include "xmas/xmas.h"
40 
41 #include "cgicc/CgiDefs.h"
42 #include "cgicc/Cgicc.h"
43 #include "cgicc/FormEntry.h"
44 
45 #include "utils.icc"
46 
47 #include <vector>
48 
49 namespace evf{
50 
51  const std::string FWEPWrapper::unknown = "unknown";
52  FWEPWrapper::FWEPWrapper(log4cplus::Logger &log, unsigned int instance)
53  : evtProcessor_(0)
54  , serviceToken_()
55  , servicesDone_(false)
56  , epInitialized_(false)
57  , prescaleSvc_(0)
58  , log_(log)
59  , isPython_(true)
60  , hasPrescaleService_(false)
61  , hasModuleWebRegistry_(false)
62  , hasServiceWebRegistry_(false)
63  , monitorInfoSpace_(0)
64  , monitorInfoSpaceLegend_(0)
65  , timeoutOnStop_(3)
66  , monSleepSec_(1)
67  , nbProcessed_(0)
68  , nbAccepted_(0)
69  , wlMonitoring_(0)
70  , asMonitoring_(0)
71  , wlMonitoringActive_(false)
72  , watching_(false)
73  , allPastLumiProcessed_(0)
74  , lsid_(0)
75  , psid_(0)
76  , lsTimeOut_(100000000)
77  , lumiSectionIndex_(1)
78  , prescaleSetIndex_(0)
79  , lastLumiPrescaleIndex_(0)
80  , lastLumiUsingEol_(0)
81  , lsTimedOut_(false)
82  , lsToBeRecovered_(true)
83  , scalersUpdateAttempted_(0)
84  , scalersUpdateCounter_(0)
85  , lumiSectionsCtr_(lsRollSize_+1)
86  , lumiSectionsTo_(lsRollSize_)
87  , rollingLsIndex_(lsRollSize_-1)
88  , rollingLsWrap_(false)
89  , rcms_(0)
90  , instance_(instance)
91  , waitingForLs_(false)
92  , mwrRef_(nullptr)
93  , sorRef_(nullptr)
94  , ftsRef_(nullptr)
95  , countDatasets_(false)
96  {
97  //list of variables for scalers flashlist
98  names_.push_back("lumiSectionIndex");
99  names_.push_back("prescaleSetIndex");
100  names_.push_back("scalersTable");
101  namesStatusLegenda_.push_back("macroStateLegenda");
102  namesStatusLegenda_.push_back("microStateLegenda");
103  namesScalersLegenda_.push_back("scalersLegenda");
104  //some initialization of state data
105  epMAltState_ = -1;
106  epmAltState_ = -1;
107  pthread_mutex_init(&ep_guard_lock_,0);
108  }
109 
111 
113  {
114 
115  applicationInfoSpace_->fireItemAvailable("monSleepSec", &monSleepSec_);
116  applicationInfoSpace_->fireItemAvailable("timeoutOnStop", &timeoutOnStop_);
117  applicationInfoSpace_->fireItemAvailable("lsTimeOut", &lsTimeOut_);
118 
119  applicationInfoSpace_->fireItemAvailable("lumiSectionIndex", &lumiSectionIndex_);
120  applicationInfoSpace_->fireItemAvailable("prescaleSetIndex", &prescaleSetIndex_);
121  applicationInfoSpace_->fireItemAvailable("lastLumiPrescaleIndex", &lastLumiPrescaleIndex_);
122  applicationInfoSpace_->fireItemAvailable("lastLumiUsingEol", &lastLumiUsingEol_);
123  applicationInfoSpace_->fireItemAvailable("lsTimedOut", &lsTimedOut_);
124  applicationInfoSpace_->fireItemAvailable("lsToBeRecovered", &lsToBeRecovered_);
125 
126  monitorLegendaInfoSpace_->fireItemAvailable("macroStateLegenda", &macro_state_legend_);
127  monitorLegendaInfoSpace_->fireItemAvailable("microStateLegenda", &micro_state_legend_);
128 
129  monitorInfoSpace_->fireItemAvailable("epMacroState", &epMState_);
130  monitorInfoSpace_->fireItemAvailable("epMicroState", &epmState_);
131 
132  xdata::Table &stbl = trh_.getTable();
133  scalersInfoSpace_->fireItemAvailable("scalersTable", &stbl);
134  scalersInfoSpace_->fireItemAvailable("lumiSectionIndex", &lumiSectionIndex_);
135  scalersInfoSpace_->fireItemAvailable("prescaleSetIndex", &prescaleSetIndex_);
136  scalersInfoSpace_->fireItemAvailable("lastLumiPrescaleIndex", &lastLumiPrescaleIndex_);
137  scalersInfoSpace_->fireItemAvailable("lastLumiUsingEol", &lastLumiUsingEol_);
138  scalersLegendaInfoSpace_->fireItemAvailable("scalersLegenda", trh_.getPathLegenda());
139 
140  scalersComplete_.addColumn("instance", "unsigned int 32");
141  scalersComplete_.addColumn("lsid", "unsigned int 32");
142  scalersComplete_.addColumn("psid", "unsigned int 32");
143  scalersComplete_.addColumn("proc", "unsigned int 32");
144  scalersComplete_.addColumn("acc", "unsigned int 32");
145  scalersComplete_.addColumn("exprep", "unsigned int 32");
146  scalersComplete_.addColumn("effrep", "unsigned int 32");
147  scalersComplete_.addColumn("triggerReport", "table");
148 
149  xdata::Table::iterator it = scalersComplete_.begin();
150  if( it == scalersComplete_.end())
151  {
152  it = scalersComplete_.append();
153  it->setField("instance",instance_);
154  }
155 
156 
157  //fill initial macrostate legenda information
158  unsigned int i = 0;
159  std::stringstream oss;
160  for(i = (unsigned int)edm::event_processor::sInit; i < (unsigned int)edm::event_processor::sInvalid; i++)
161  {
162  oss << i << "=" << evtProcessor_->stateName((edm::event_processor::State) i) << " ";
164  }
165  oss << i << "=" << "NotStarted ";
166  statmod_.push_back("NotStarted");
168  std::stringstream oss2;
169  oss2 << 0 << "=Invalid ";
170  modmap_["Invalid"]=0;
171  mapmod_.resize(1);
172  mapmod_[0]="Invalid";
173 
174  monitorInfoSpace_->lock();
175  macro_state_legend_ = oss.str();
176  micro_state_legend_ = oss2.str();
177  monitorInfoSpace_->unlock();
178 
179  if(!multi) publishConfigAndMonitorItemsSP();
180 
181  }
182 
184  {
185  monitorInfoSpace_->fireItemAvailable("epSPMacroStateInt", &epMAltState_);
186  monitorInfoSpace_->fireItemAvailable("epSPMicroStateInt", &epmAltState_);
187 
188  monitorInfoSpace_->fireItemAvailable("nbProcessed", &nbProcessed_);
189  monitorInfoSpace_->fireItemAvailable("nbAccepted", &nbAccepted_);
190  }
191 
192 
193  void FWEPWrapper::init(unsigned short serviceMap, std::string &configString)
194  {
195  hasPrescaleService_ = serviceMap & 0x1;
196  hasModuleWebRegistry_ = serviceMap & 0x2;
197  hasServiceWebRegistry_ = serviceMap & 0x4;
198  bool instanceZero = serviceMap & 0x8;
199  hasSubProcesses = serviceMap & 0x10;
200  countDatasets_ = (serviceMap&0x20)>0;
201  configString_ = configString;
202  trh_.resetFormat(); //reset the report table even if HLT didn't change
204  if (epInitialized_) {
205  LOG4CPLUS_INFO(log_,"CMSSW EventProcessor already initialized: skip!");
206  return;
207  }
208 
209  LOG4CPLUS_INFO(log_,"Initialize CMSSW EventProcessor.");
210  LOG4CPLUS_INFO(log_,"CMSSW_BASE:"<<getenv("CMSSW_BASE"));
211 
212  //end job of previous EP instance
213  if (0!=evtProcessor_) {
217  }
218  delete evtProcessor_;
219  evtProcessor_=0;
220  }
221 
222  // job configuration string
226 
227  if (configString_.size() > 3 && configString_.substr(configString_.size()-3) == ".py") isPython_ = true;
228  boost::shared_ptr<edm::ParameterSet> params; // change this name!
229  boost::shared_ptr<std::vector<edm::ParameterSet> > pServiceSets;
230  boost::shared_ptr<edm::ProcessDesc> pdesc;
231  if(isPython_)
232  {
234  pdesc = ppdesc.processDesc();
235  }
236  else
237  pdesc = boost::shared_ptr<edm::ProcessDesc>(new edm::ProcessDesc(configuration_));
238  pServiceSets = pdesc->getServicesPSets();
239 
240  // add default set of services
241  if(!servicesDone_) {
242  //DQMStore should not be created in the Master (MP case) since this poses problems in the slave
243  if(!hasSubProcesses){
244  internal::addServiceMaybe(*pServiceSets,"DQMStore");
245  internal::addServiceMaybe(*pServiceSets,"DQM");
246  }
247  else{
248  internal::removeServiceMaybe(*pServiceSets,"DQMStore");
249  internal::removeServiceMaybe(*pServiceSets,"DQM");
250  }
251  internal::addServiceMaybe(*pServiceSets,"MLlog4cplus");
252  internal::addServiceMaybe(*pServiceSets,"MicroStateService");
253  internal::addServiceMaybe(*pServiceSets,"ShmOutputModuleRegistry");
254  if(hasPrescaleService_) internal::addServiceMaybe(*pServiceSets,"PrescaleService");
255  if(hasModuleWebRegistry_) internal::addServiceMaybe(*pServiceSets,"ModuleWebRegistry");
256  if(hasServiceWebRegistry_) internal::addServiceMaybe(*pServiceSets,"ServiceWebRegistry");
257 
258  try{
260  internal::addServiceMaybe(*pServiceSets,"DQMStore");
261  internal::addServiceMaybe(*pServiceSets,"DQM");
262  // slaveServiceToken_ = edm::ServiceRegistry::createSet(*pServiceSets);
263  }
264  catch(cms::Exception &e) {
265  LOG4CPLUS_ERROR(log_,e.explainSelf());
266  }
267  catch(std::exception &e) {
268  LOG4CPLUS_ERROR(log_,e.what());
269  }
270  catch(...) {
271  LOG4CPLUS_ERROR(log_,"Unknown Exception");
272  }
273  servicesDone_ = true;
274  }
275 
277 
278 
279  //test rerouting of fwk logging to log4cplus
280  edm::LogInfo("FWEPWrapper")<<"started MessageLogger Service.";
281  edm::LogInfo("FWEPWrapper")<<"Using config \n"<<configuration_;
282 
283  DQMStore *dqm = 0;
284  try{
285  if(edm::Service<DQMStore>().isAvailable())
286  dqm = edm::Service<DQMStore>().operator->();
287  }
288  catch(...) {
289  LOG4CPLUS_INFO(log_,
290  "exception when trying to get service DQMStore");
291  }
292  if(dqm!=0) dqm->rmdir("");
293 
294 
295  ModuleWebRegistry *mwr = 0;
296  try{
297  if(edm::Service<ModuleWebRegistry>().isAvailable())
299  }
300  catch(...) {
301  LOG4CPLUS_INFO(log_,
302  "exception when trying to get service ModuleWebRegistry");
303  }
304  mwrRef_=mwr;
305 
306  if(mwr) mwr->clear(); // in case we are coming from stop we need to clear the mwr
307 
308  ServiceWebRegistry *swr = 0;
309  try{
310  if(edm::Service<ServiceWebRegistry>().isAvailable())
312  }
313  catch(...) {
314  LOG4CPLUS_INFO(log_,
315  "exception when trying to get service ModuleWebRegistry");
316  }
317  ShmOutputModuleRegistry *sor = 0;
318  try{
319  if(edm::Service<ShmOutputModuleRegistry>().isAvailable())
321  }
322  catch(...) {
323  LOG4CPLUS_INFO(log_,
324  "exception when trying to get service ShmOutputModuleRegistry");
325  }
326  if(sor) sor->clear();
327  sorRef_=sor;
328  // if(swr) swr->clear(); // in case we are coming from stop we need to clear the swr
329 
330 
331  FastTimerService *fts = 0;
332  try{
333  if(edm::Service<FastTimerService>().isAvailable())
335  }
336  catch(...) {
337  LOG4CPLUS_INFO(log_,
338  "exception when trying to get service FastTimerService");
339  }
340  ftsRef_=fts;
341 
342  //get and copy streams and datasets PSet from the framework configuration
343  edm::ParameterSet streamsPSet;
344  edm::ParameterSet datasetsPSet;
345  if (countDatasets_)
346  try {
347  streamsPSet = pdesc->getProcessPSet()->getParameter<edm::ParameterSet>("streams");
348  datasetsPSet = pdesc->getProcessPSet()->getParameter<edm::ParameterSet>("datasets");
349  }
350  catch (...) {
351  streamsPSet = edm::ParameterSet();
352  datasetsPSet = edm::ParameterSet();
353  }
354 
355  // instantiate the event processor - fatal exceptions are caught in the main application
356 
357  std::vector<std::string> defaultServices;
358  std::vector<std::string> forcedServices;
359  defaultServices.push_back("MessageLogger");
360  defaultServices.push_back("InitRootHandlers");
361  defaultServices.push_back("JobReportService");
362  pdesc->addServices(defaultServices, forcedServices);
363  pthread_mutex_lock(&ep_guard_lock_);
364 
368  pthread_mutex_unlock(&ep_guard_lock_);
369  // evtProcessor_->setRunNumber(runNumber_.value_);
370  /* removed
371  if(!outPut_)
372  evtProcessor_->enableEndPaths(outPut_);
373  outprev_=outPut_;
374  */
375  // publish all module names to XDAQ infospace
376 
377  if(mwr)
378  {
381  }
382  if(swr)
383  {
385  }
386  if (sor && countDatasets_)
387  {
388  sor->insertStreamAndDatasetInfo(streamsPSet,datasetsPSet);
389  sor->updateDatasetInfo();
390  }
391  // get the prescale service
392  LOG4CPLUS_INFO(log_,
393  "Checking for edm::service::PrescaleService!");
394  try {
396  {
397  LOG4CPLUS_INFO(log_,
398  "edm::service::PrescaleService is available!");
400  LOG4CPLUS_INFO(log_,
401  "Obtained pointer to PrescaleService");
402  }
403  }
404  catch(...) {
405  LOG4CPLUS_INFO(log_,
406  "exception when trying to get service "
407  <<"edm::service::PrescaleService");
408  }
409  const edm::ParameterSet *prescaleSvcConfig = internal::findService(*pServiceSets,"PrescaleService");
410  if(prescaleSvc_ != 0 && prescaleSvcConfig !=0) prescaleSvc_->reconfigure(*prescaleSvcConfig);
411 
412  monitorLegendaInfoSpace_->lock();
413  //fill microstate legenda information
415 
416  std::stringstream oss2;
417  unsigned int outcount = 0;
418  oss2 << 0 << "=Invalid ";
419  oss2 << 1 << "=FwkOvh ";
420  oss2 << 2 << "=Input ";
421  modmap_["Invalid"]=0;
422  modmap_["FWKOVH"]=1;
423  modmap_["INPUT"]=2;
424  mapmod_.resize(descs_.size()+4); // all modules including output plus one input plus DQM plus the invalid state 0
425  mapmod_[0]="Invalid";
426  mapmod_[1]="FWKOVH";
427  mapmod_[2]="INPUT";
428  outcount+=2;
429  for(unsigned int j = 0; j < descs_.size(); j++)
430  {
431  if(descs_[j]->moduleName() == "ShmStreamConsumer") // find something better than hardcoding name
432  {
433  outcount++;
434  oss2 << outcount << "=" << descs_[j]->moduleLabel() << " ";
435  modmap_[descs_[j]->moduleLabel()]=outcount;
436  mapmod_[outcount] = descs_[j]->moduleLabel();
437  }
438  }
439  modmap_["DQM"]=outcount+1;
440  mapmod_[outcount+1]="DQM";
441  oss2 << outcount+1 << "=DQMHistograms ";
442  unsigned int modcount = 1;
443  for(unsigned int i = 0; i < descs_.size(); i++)
444  {
445  if(descs_[i]->moduleName() != "ShmStreamConsumer")
446  {
447  modcount++;
448  oss2 << outcount+modcount << "=" << descs_[i]->moduleLabel() << " ";
449  modmap_[descs_[i]->moduleLabel()]=outcount+modcount;
450  mapmod_[outcount+modcount] = descs_[i]->moduleLabel();
451  }
452  }
453 // std::cout << "*******************************microstate legend**************************" << std::endl;
454 // std::cout << oss2.str() << std::endl;
455 // std::cout << "*******************************microstate legend**************************" << std::endl;
456 
457  if(instanceZero){
458  micro_state_legend_ = oss2.str().c_str();
459  }
460  monitorLegendaInfoSpace_->unlock();
461  try{
462  monitorLegendaInfoSpace_->fireItemGroupChanged(namesStatusLegenda_,0);
463  scalersLegendaInfoSpace_->fireItemGroupChanged(namesScalersLegenda_,0);
464  ::usleep(10);
465  }
467  {
468  LOG4CPLUS_ERROR(log_, "Exception from fireItemGroupChanged: " << e.what());
469  }
470  LOG4CPLUS_INFO(log_," edm::EventProcessor configuration finished.");
473  trh_.formatReportTable(tr,descs_,pathTable_,instanceZero);
474  epInitialized_ = true;
475  return;
476  }
477 
478  //______________________________________________________________________________
480  {
482  }
483 
484  //______________________________________________________________________________
486  {
487  return mwrRef_;
488  }
489 
490  //______________________________________________________________________________
492  {
493  return sorRef_;
494  }
495 
496  //______________________________________________________________________________
497  void FWEPWrapper::setupFastTimerService(unsigned int nProcesses)
498  {
499  if (ftsRef_) ftsRef_->setNumberOfProcesses( nProcesses );
500  }
501 
502  //______________________________________________________________________________
504  {
506 
507  LOG4CPLUS_WARN(log_,"FUEventProcessor::stopEventProcessor.1 state "
508  << evtProcessor_->stateName(st));
510 
511  //total stopping time allowed before epTimeout/epOther
512  unsigned int stopTimeLeft = (timeoutOnStop_.value_+1)*1000000;
513  if (timeoutOnStop_.value_==0) stopTimeLeft=1500000;
514 
516  || st==edm::event_processor::sDone)) {
517  usleep(100000);
518  st = evtProcessor_->getState();
519  if (stopTimeLeft<500000) {
520  break;
521  }
522  stopTimeLeft-=100000;
523  }
524  //if already in stopped state
527 
528  //if not even in stopping state
530  LOG4CPLUS_WARN(log_,
531  "FUEventProcessor::stopEventProcessor.2 After 1s - state: "
532  << evtProcessor_->stateName(st));
534  }
535  LOG4CPLUS_WARN(log_,"FUEventProcessor::stopEventProcessor.3 state "
536  << evtProcessor_->stateName(st));
537 
538  //use remaining time left for the framework timeout
539  if (stopTimeLeft<1000000) stopTimeLeft=1000000;
540  stopTimeLeft/=1000000;
541  if (timeoutOnStop_.value_==0) stopTimeLeft=0;
542 
543  try {
544  rc = evtProcessor_->waitTillDoneAsync(stopTimeLeft);
545  watching_ = false;
546  }
547  catch(cms::Exception &e) {
548  XCEPT_RAISE(evf::Exception,e.explainSelf());
549  }
550  catch(std::exception &e) {
551  XCEPT_RAISE(evf::Exception,e.what());
552  }
553  catch(...) {
554  XCEPT_RAISE(evf::Exception,"Unknown Exception");
555  }
557  return rc;
558 
559  }
560 
562  {
564  ModuleWebRegistry *mwr = 0;
565  try{
566  if(edm::Service<ModuleWebRegistry>().isAvailable())
568  }
569  catch(...) {
570  LOG4CPLUS_INFO(log_,
571  "exception when trying to get service ModuleWebRegistry");
572  }
573 
574  if(mwr)
575  {
576  mwr->clear();
577  }
578 
579  ServiceWebRegistry *swr = 0;
580  try{
581  if(edm::Service<ServiceWebRegistry>().isAvailable())
583  }
584  catch(...) {
585  LOG4CPLUS_INFO(log_,
586  "exception when trying to get service ModuleWebRegistry");
587  }
588 
589  if(swr)
590  {
591  swr->clear();
592  }
593 
596  watching_ = false;
598  {
601  pthread_mutex_lock(&ep_guard_lock_);
602  delete evtProcessor_;
603  evtProcessor_ = 0;
604  pthread_mutex_unlock(&ep_guard_lock_);
605  epInitialized_ = false;
606  }
607  else
608  {
609  XCEPT_RAISE(evf::Exception,"EventProcessor stop timed out");
610  }
612  }
613 
615  {
616  pid_t pid = getpid();
617  nbProcessed_.value_ = 0;
618  nbAccepted_.value_ = 0;
619  struct timezone timezone;
620  gettimeofday(&monStartTime_,&timezone);
621 
622  std::ostringstream ost;
623  ost << "Monitoring" << pid;
624  try {
626  toolbox::task::getWorkLoopFactory()->getWorkLoop(ost.str().c_str(),
627  "waiting");
628 
629  if (!wlMonitoring_->isActive()) wlMonitoring_->activate();
630  asMonitoring_ = toolbox::task::bind(this,&FWEPWrapper::monitoring,
631  ost.str().c_str());
632 
633  wlMonitoring_->submit(asMonitoring_);
634  wlMonitoringActive_ = true;
635 
636  }
637  catch (xcept::Exception& e) {
638  std::string msg = "Failed to start workloop 'Monitoring'.";
639 
640  XCEPT_RETHROW(evf::Exception,msg,e);
641  }
642  }
643 
644 
645 
646  //______________________________________________________________________________
647  bool FWEPWrapper::monitoring(toolbox::task::WorkLoop* wl)
648  {
649 
650  struct timeval monEndTime;
651  struct timezone timezone;
652  gettimeofday(&monEndTime,&timezone);
654  MicroStateService *mss = 0;
655  if(!hasSubProcesses) monitorInfoSpace_->lock();
656  if(evtProcessor_)
657  {
660  }
661  else
662  {
663  epMState_ = "Off";
664  epMAltState_ = -1;
665  }
667  {
668  try{
670  }
671  catch(...) {
672  LOG4CPLUS_INFO(log_,
673  "exception when trying to get service MicroStateService");
674  }
675  lsid_ = lumiSectionIndex_.value_;
676  psid_ = prescaleSetIndex_.value_;
677  }
678  if(mss)
679  {
680  epmState_ = mss->getMicroState2();
682  }
683  if(evtProcessor_)
684  {
687  }
688  if(!hasSubProcesses) monitorInfoSpace_->unlock();
689 
690  ::sleep(monSleepSec_.value_);
691  return true;
692  }
693 
694  bool FWEPWrapper::getTriggerReport(bool useLock)
695  {
697  // Calling this method results in calling
698  // evtProcessor_->getTriggerReport, the value returned is encoded as
699  // a xdata::Table.
700 
701  LOG4CPLUS_DEBUG(log_,"getTriggerReport action invoked");
702 
703  //Get the trigger report.
704  ModuleWebRegistry *mwr = 0;
705  try{
706  if(edm::Service<ModuleWebRegistry>().isAvailable())
708  }
709  catch(...) {
710  LOG4CPLUS_INFO(log_,
711  "exception when trying to get service ModuleWebRegistry");
712  return false;
713  }
714  edm::TriggerReport tr;
715  if(mwr==0) return false;
716 
717  unsigned int ls = 0;
718  unsigned int ps = 0;
719  timeval tv;
720  if(useLock) {
721  gettimeofday(&tv,0);
722  // std::cout << getpid() << " calling openBackdoor " << std::endl;
723  //waitingForLs_ = true;//moving this behind mutex lock
724  mwr->openBackDoor("DaqSource",lsTimeOut_,&waitingForLs_);
725  // std::cout << getpid() << " opened Backdoor " << std::endl;
726  }
727 
728  xdata::Table::iterator it = scalersComplete_.begin();
729  ps = lastLumiPrescaleIndex_.value_;
730  // if(prescaleSvc_ != 0) prescaleSvc_->setIndex(ps);
731  it->setField("psid",lastLumiPrescaleIndex_);
732  psid_ = prescaleSetIndex_.value_;
734  ls = lumiSectionIndex_.value_;
735  localLsIncludingTimeOuts_.value_ = ls;
736  it->setField("lsid", localLsIncludingTimeOuts_);
737 
738  lsTriplet lst;
739  lst.ls = localLsIncludingTimeOuts_.value_;
745 
746 
748 
749  if(useLock){
750  // std::cout << getpid() << " calling closeBackdoor " << std::endl;
751  mwr->closeBackDoor("DaqSource");
752  // std::cout << getpid() << " closed Backdoor " << std::endl;
753  }
754 
756 
757 
759  ShmOutputModuleRegistry *sor = 0;
760  try{
762  sor = edm::Service<ShmOutputModuleRegistry>().operator->();
763  }
764  catch(...) {
765  LOG4CPLUS_INFO(log_,
766  "exception when trying to get service ShmOutputModuleRegistry");
767  return false;
768  }
769 
770 
772  it->setField("triggerReport",trh_.getTableWithNames());
773  // std::cout << getpid() << " returning normally from gettriggerreport " << std::endl;
774  return true;
775  }
776 
778  {
779  // trh_.printReportTable();
781  //@@EM commented out on
782  // @@EM 21.06.2011 - this flashlist is too big to be handled by LAS
783  /*
784  try{
785  // scalersInfoSpace_->unlock();
786  // scalersInfoSpace_->fireItemGroupChanged(names_,0);
787  ::usleep(10);
788  // scalersInfoSpace_->lock();
789  }
790  catch(xdata::exception::Exception &e)
791  {
792  LOG4CPLUS_ERROR(log_, "Exception from fireItemGroupChanged: " << e.what());
793  // localLog(e.what());
794  return false;
795  }
796  */
797  //@@EM added on 21.06.2011
798  // refresh the microstate legenda every 10 lumisections
799  if(scalersUpdateAttempted_%10 == 0)
800  monitorLegendaInfoSpace_->fireItemGroupChanged(namesStatusLegenda_,0);
801 
802  //if there is no state listener then do not attempt to send to monitorreceiver
803  if(rcms_==0) return false;
804  try{
805  if(trh_.getProcThisLumi()!=0U)
808  }
809  catch(...){return false;}
810  return true;
811  }
812 
813 
814  //______________________________________________________________________________
816  {
817  // std::string urn = xappDesc_->getURN();
818 
819  *out << "<table>" << std::endl;
820 
821  *out << "<tr valign=\"top\">" << std::endl;
822  *out << "<td>" << std::endl;
823 
825  // trigger summary table
826  *out << "<table border=1 bgcolor=\"#CFCFCF\">" << std::endl;
827  *out << " <tr>" << std::endl;
828  *out << " <th colspan=7>" << std::endl;
829  *out << " " << "Trigger Summary up to LS "
830  << trh_.getLumiSectionReferenceIndex()-1 << std::endl;
831  *out << " </th>" << std::endl;
832  *out << " </tr>" << std::endl;
833 
834  *out << " <tr >" << std::endl;
835  *out << " <th >Path</th>" << std::endl;
836  *out << " <th >Exec</th>" << std::endl;
837  *out << " <th >Pass</th>" << std::endl;
838  *out << " <th >Fail</th>" << std::endl;
839  *out << " <th >Except</th>" << std::endl;
840  *out << " </tr>" << std::endl;
841 
842 
843  for(int i=0; i<tr->trigPathsInMenu; i++) {
844  *out << " <tr>" << std::endl;
845  *out << " <td>"<< i << "</td>" << std::endl;
846  *out << " <td>" << trh_.getl1pre(i) << "</td>" << std::endl;
847  *out << " <td>" << trh_.getaccept(i) << "</td>" << std::endl;
848  *out << " <td >" << trh_.getfailed(i) << "</td>" << std::endl;
849  *out << " <td ";
850  if(trh_.getexcept(i) !=0)
851  *out << "bgcolor=\"red\"" << std::endl;
852  *out << ">" << trh_.getexcept(i) << "</td>" << std::endl;
853  *out << " </tr >" << std::endl;
854 
855  }
856  *out << " <tr><th colspan=7>EndPaths</th></tr>" << std::endl;
857 
858  for(int i=tr->trigPathsInMenu; i<tr->endPathsInMenu + tr->trigPathsInMenu; i++) {
859  *out << " <tr>" << std::endl;
860  *out << " <td>"<< i << "</td>" << std::endl;
861  *out << " <td>" << trh_.getl1pre(i) << "</td>" << std::endl;
862  *out << " <td>" << trh_.getaccept(i) << "</td>" << std::endl;
863  *out << " <td >" << trh_.getfailed(i) << "</td>" << std::endl;
864  *out << " <td ";
865  if(trh_.getexcept(i) !=0)
866  *out << "bgcolor=\"red\"" << std::endl;
867  *out << ">" << trh_.getexcept(i) << "</td>" << std::endl;
868  *out << " </tr >" << std::endl;
869 
870  }
871 
872 
873  *out << "</table>" << std::endl;
874  *out << "</td>" << std::endl;
875  *out << "</tr>" << std::endl;
876  *out << "</table>" << std::endl;
877  }
878 
879 
880  //______________________________________________________________________________
882  {
883  // std::string urn = xappDesc_->getURN();
884  ModuleWebRegistry *mwr = 0;
886  try{
888  mwr = edm::Service<ModuleWebRegistry>().operator->();
889  }
890  catch(...) {
891  LOG4CPLUS_WARN(log_,
892  "Exception when trying to get service ModuleWebRegistry");
893  }
894  TimeProfilerService *tpr = 0;
895  try{
896  if(edm::Service<TimeProfilerService>().isAvailable())
898  }
899  catch(...) {
900  }
901 
902  *out << "<table>" << std::endl;
903 
904  *out << "<tr valign=\"top\">" << std::endl;
905  *out << "<td>" << std::endl;
906 
907 
908  edm::TriggerReport tr;
910 
911  // trigger summary table
912  *out << "<table border=1 bgcolor=\"#CFCFCF\">" << std::endl;
913  *out << " <tr>" << std::endl;
914  *out << " <th colspan=7>" << std::endl;
915  *out << " " << "Trigger Summary" << std::endl;
916  *out << " </th>" << std::endl;
917  *out << " </tr>" << std::endl;
918 
919  *out << " <tr >" << std::endl;
920  *out << " <th >Path</th>" << std::endl;
921  *out << " <th >Exec</th>" << std::endl;
922  *out << " <th >Pass</th>" << std::endl;
923  *out << " <th >Fail</th>" << std::endl;
924  *out << " <th >Except</th>" << std::endl;
925  *out << " <th >TargetPF</th>" << std::endl;
926  *out << " </tr>" << std::endl;
927  xdata::Serializable *psid = 0;
928  try{
929  psid = applicationInfoSpace_->find("prescaleSetIndex");
930  }
932  }
933  ShmOutputModuleRegistry *sor = 0;
934  try{
935  if(edm::Service<ShmOutputModuleRegistry>().isAvailable())
937  }
938  catch(...) {
939  LOG4CPLUS_INFO(log_,
940  "exception when trying to get service ShmOutputModuleRegistry");
941  }
942 
943 
944  for(unsigned int i=0; i<tr.trigPathSummaries.size(); i++) {
945  *out << " <tr>" << std::endl;
946  *out << " <td>"<< tr.trigPathSummaries[i].name << "</td>" << std::endl;
947  *out << " <td>" << tr.trigPathSummaries[i].timesRun << "</td>" << std::endl;
948 
949  *out << " <td>" << tr.trigPathSummaries[i].timesPassed << "</td>" << std::endl;
950  *out << " <td >" << tr.trigPathSummaries[i].timesFailed << "</td>" << std::endl;
951 
952  *out << " <td ";
953  if(tr.trigPathSummaries[i].timesExcept !=0)
954  *out << "bgcolor=\"red\"" << std::endl;
955  *out << ">" << tr.trigPathSummaries[i].timesExcept << "</td>" << std::endl;
956  if(psid != 0)
957  {
958  *out << " <td>"
960  << "</td>" << std::endl;
961  }
962  else *out << " <td>N/A</td>" << std::endl;
963  *out << " </tr >" << std::endl;
964 
965  }
966 
967 
968 
969  for(unsigned int i=0; i<tr.endPathSummaries.size(); i++) {
971  i,"ShmStreamConsumer");
972  evf::OutputModule *o = sor->get(olab);
973  *out << " <tr>" << std::endl;
974  *out << " <td>"<< tr.endPathSummaries[i].name << "</td>" << std::endl;
975  *out << " <td>" << tr.endPathSummaries[i].timesRun << "</td>" << std::endl;
976  *out << " <td>" << (o ? o->getCounts() : -1) << "</td>" << std::endl;
977  *out << " <td >" << (o ? (tr.endPathSummaries[i].timesRun - o->getCounts()) : -1) << "</td>" << std::endl;
978  *out << " <td ";
979  if(tr.endPathSummaries[i].timesExcept !=0)
980  *out << "bgcolor=\"red\"" << std::endl;
981  *out << ">" << tr.endPathSummaries[i].timesExcept << "</td>" << std::endl;
982  *out << " <td>N/A</td>" << std::endl;
983  *out << " </tr >" << std::endl;
984 
985  }
986 
987  *out << "</table>" << std::endl;
988 
989  *out << "</td>" << std::endl;
990 
991 
992 
993  *out << "<td>" << std::endl;
994  //Process details table
995  *out << "<table frame=\"void\" rules=\"rows\" class=\"modules\">" << std::endl;
996  *out << " <tr>" << std::endl;
997  *out << " <th colspan=3>" << std::endl;
998  *out << " " << "HLT" << std::endl;
999  if(descs_.size()>0)
1000  *out << " (Process " << descs_[0]->processName() << ")" << std::endl;
1001  *out << " </th>" << std::endl;
1002  *out << " </tr>" << std::endl;
1003 
1004  *out << " <tr >" << std::endl;
1005  *out << " <th >" << std::endl;
1006  *out << " Module" << std::endl;
1007  *out << " </th>" << std::endl;
1008  *out << " <th >" << std::endl;
1009  *out << " Label" << std::endl;
1010  *out << " </th>" << std::endl;
1011  *out << " <th >" << std::endl;
1012  *out << " Version" << std::endl;
1013  *out << " </th>" << std::endl;
1014  if(tpr)
1015  {
1016  *out << " <th >" << std::endl;
1017  *out << " first" << std::endl;
1018  *out << " </th>" << std::endl;
1019  *out << " <th >" << std::endl;
1020  *out << " ave" << std::endl;
1021  *out << " </th>" << std::endl;
1022  *out << " <th >" << std::endl;
1023  *out << " max" << std::endl;
1024  *out << " </th>" << std::endl;
1025  }
1026  *out << " </tr>" << std::endl;
1027  if(mwr && mwr->checkWeb("DaqSource"))
1028  *out << " <tr><td ><a href=\"/" << urn
1029  << "module=DaqSource\">DaqSource</a> </td></tr>";
1030 
1031  for(unsigned int idesc = 0; idesc < descs_.size(); idesc++)
1032  {
1033  *out << " <tr>" << std::endl;
1034  *out << " <td >";
1035  if(mwr && mwr->checkWeb(descs_[idesc]->moduleName()))
1036  *out << "<a href=\"/" << urn
1037  << "module="
1038  << descs_[idesc]->moduleName() << "\">"
1039  << descs_[idesc]->moduleName() << "</a>";
1040  else
1041  *out << descs_[idesc]->moduleName();
1042  *out << "</td>" << std::endl;
1043  *out << " <td >";
1044  *out << descs_[idesc]->moduleLabel();
1045  *out << "</td>" << std::endl;
1046  *out << " <td >";
1047  *out << descs_[idesc]->releaseVersion();
1048  *out << "</td>" << std::endl;
1049  if(tpr)
1050  {
1051  *out << " <td align=\"right\">";
1052  *out << tpr->getFirst(descs_[idesc]->moduleLabel());
1053  *out << "</td>" << std::endl;
1054  *out << " <td align=\"right\"";
1055  *out << (tpr->getAve(descs_[idesc]->moduleLabel())>1. ? "bgcolor=\"red\"" : "")
1056  << ">";
1057  *out << tpr->getAve(descs_[idesc]->moduleLabel());
1058  *out << "</td>" << std::endl;
1059  *out << " <td align=\"right\">";
1060  *out << tpr->getMax(descs_[idesc]->moduleLabel());
1061  *out << "</td>" << std::endl;
1062  }
1063  *out << " </tr>" << std::endl;
1064  }
1065  *out << "</table>" << std::endl;
1066  *out << "</td>" << std::endl;
1067  }
1068 
1069  //______________________________________________________________________________
1071  {
1072  using namespace cgicc;
1073  Cgicc cgi(in);
1074  std::vector<FormEntry> el1;
1075  cgi.getElement("module",el1);
1076  if(evtProcessor_) {
1077  if(el1.size()!=0) {
1078  std::string mod = el1[0].getValue();
1080  ModuleWebRegistry *mwr = 0;
1081  try{
1083  mwr = edm::Service<ModuleWebRegistry>().operator->();
1084  }
1085  catch(...) {
1086  LOG4CPLUS_WARN(log_,
1087  "Exception when trying to get service ModuleWebRegistry");
1088  }
1089  mwr->invoke(in,out,mod);
1090  }
1091  }
1092  else {
1093  *out<<"EventProcessor just disappeared "<<std::endl;
1094  }
1095  }
1096 
1097 
1098  //______________________________________________________________________________
1100  {
1101  using namespace cgicc;
1102  Cgicc cgi(in);
1103  std::vector<FormEntry> el1;
1104  cgi.getElement("service",el1);
1105  if(evtProcessor_) {
1106  if(el1.size()!=0) {
1107  std::string ser = el1[0].getValue();
1109  ServiceWebRegistry *swr = 0;
1110  try{
1112  swr = edm::Service<ServiceWebRegistry>().operator->();
1113  }
1114  catch(...) {
1115  LOG4CPLUS_WARN(log_,
1116  "Exception when trying to get service ModuleWebRegistry");
1117  }
1118  swr->invoke(in,out,ser);
1119  }
1120  }
1121  else {
1122  *out<<"EventProcessor just disappeared "<<std::endl;
1123  }
1124  }
1125 
1126 //______________________________________________________________________________
1128  {
1130  MicroStateService *mss = 0;
1131  std::string micro1 = "unavailable";
1132  if(epInitialized_)
1133  micro1 = "initialized";
1134  std::string micro2 = "unavailable";
1136  {
1137  try{
1139  }
1140  catch(...) {
1141  LOG4CPLUS_INFO(log_,
1142  "exception when trying to get service MicroStateService");
1143  }
1144  pthread_mutex_lock(&ep_guard_lock_);
1145  if(evtProcessor_!=0) micro1 = evtProcessor_->currentStateName();
1146  pthread_mutex_unlock(&ep_guard_lock_);
1147  }
1148 
1149  if(mss) {
1150  micro2 = mss->getMicroState2();
1151  }
1152 
1153  // *out << fsm_.stateName()->toString() << std::endl;
1154  *out << "<td>" << micro1 << "</td>";
1155  *out << "<td>" << micro2 << "</td>";
1156  *out << "<td>" << nbAccepted_.value_ << "/" << nbProcessed_.value_
1157  << " (" << float(nbAccepted_.value_)/float(nbProcessed_.value_)*100. <<"%)" << "</td>";
1158  *out << "<td>" << lsid_ << "/" << lsidTimedOutAsString_ << "</td>";
1159  *out << "<td>" << psid_ << "</td>";
1160 
1161 
1162  }
1163 
1165  {
1166  // lumisection summary table
1167  *out << " <table border=1 bgcolor=\"#CFCFCF\">" << std::endl;
1168  *out << " <tr>" << std::endl;
1169  *out << " <td> LS </td>";
1170  if(rollingLsWrap_)
1171  {
1172  for(unsigned int i = rollingLsIndex_; i < lumiSectionsCtr_.size(); i++)
1173  *out << "<td " << (lumiSectionsTo_[i] ? "bgcolor=\"red\"" : "")
1174  << ">" << lumiSectionsCtr_[i].ls << "</td>" << std::endl;
1175  for(unsigned int i = 0; i < rollingLsIndex_; i++)
1176  *out << "<td " << (lumiSectionsTo_[i] ? "bgcolor=\"red\"" : "")
1177  << ">" << lumiSectionsCtr_[i].ls << "</td>" << std::endl;
1178  }
1179  else
1180  for(unsigned int i = rollingLsIndex_; i < lumiSectionsCtr_.size(); i++)
1181  *out << "<td " << (lumiSectionsTo_[i] ? "bgcolor=\"red\"" : "")
1182  << ">" << lumiSectionsCtr_[i].ls << "</td>" << std::endl;
1183 
1184  *out << " </tr>" << std::endl;
1185  *out << " <tr>" << std::endl;
1186  *out << " <td> Ev </td>";
1187  if(rollingLsWrap_)
1188  {
1189  for(unsigned int i = rollingLsIndex_; i < lumiSectionsCtr_.size(); i++)
1190  *out << "<td>" << lumiSectionsCtr_[i].proc << "</td>" << std::endl;
1191  for(unsigned int i = 0; i < rollingLsIndex_; i++)
1192  *out << "<td>" << lumiSectionsCtr_[i].proc << "</td>" << std::endl;
1193  }
1194  else
1195  for(unsigned int i = rollingLsIndex_; i < lumiSectionsCtr_.size(); i++)
1196  *out << "<td>" << lumiSectionsCtr_[i].proc << "</td>" << std::endl;
1197  *out << " </tr>" << std::endl;
1198  *out << " <tr>" << std::endl;
1199  *out << " <td> Acc </td>";
1200  if(rollingLsWrap_)
1201  {
1202  for(unsigned int i = rollingLsIndex_; i < lumiSectionsCtr_.size(); i++)
1203  *out << "<td>" << lumiSectionsCtr_[i].acc << "</td>" << std::endl;
1204  for(unsigned int i = 0; i < rollingLsIndex_; i++)
1205  *out << "<td>" << lumiSectionsCtr_[i].acc << "</td>" << std::endl;
1206  }
1207  else
1208  for(unsigned int i = rollingLsIndex_; i < lumiSectionsCtr_.size(); i++)
1209  *out << "<td>" << lumiSectionsCtr_[i].acc << "</td>" << std::endl;
1210  *out << " </tr>" << std::endl;
1211  *out << "</table>" << std::endl;
1212  }
1213 
1214 
1216  {
1218  }
1220  {
1223  rollingLsIndex_--;
1224  xdata::UnsignedInteger32* lsp = 0;
1225  xdata::UnsignedInteger32* psp = 0;
1227  lsTriplet lst;
1228  lst.ls = tr->lumiSection;
1229  lsid_ = tr->lumiSection;
1230  lst.proc = tr->eventSummary.totalEvents;
1232  xdata::Serializable *psid = 0;
1233  xdata::Serializable *lsid = 0;
1234  xdata::Serializable *nbs = 0;
1235  xdata::Serializable *nbsr = 0;
1236  try{
1237  lsid =applicationInfoSpace_->find("lumiSectionIndex");
1238  if(lsid!=0){
1239  lsp = ((xdata::UnsignedInteger32*)lsid);
1240  lsp->value_= tr->lumiSection;
1241  }
1242  psid = applicationInfoSpace_->find("lastLumiPrescaleIndex");
1243  if(psid!=0) {
1244  psp = ((xdata::UnsignedInteger32*)psid);
1245  if(tr->eventSummary.totalEvents != 0)
1246  psp->value_ = tr->prescaleIndex;
1247  }
1248  nbs = applicationInfoSpace_->find("nbSubProcesses");
1249  nbsr = applicationInfoSpace_->find("nbSubProcessesReporting");
1250  }
1252  }
1253 
1254  xdata::Table::iterator it = scalersComplete_.begin();
1255  if(lsp)
1256  it->setField("lsid", *lsp);
1257  if(psp)
1258  it->setField("psid", *psp);
1259  if(nbs)
1260  it->setField("exprep", *nbs);
1261  else
1262  std::cout << "nbSubProcesses item not found !!!" << std::endl;
1263  if(nbsr)
1264  it->setField("effrep", *nbsr);
1265  else
1266  std::cout << "nbSubProcessesReporting item not found !!!" << std::endl;
1267 
1268  it->setField("proc",trh_.getProcThisLumi());
1269  it->setField("acc",trh_.getAccThisLumi());
1270  it->setField("triggerReport",trh_.getTableWithNames());
1272 
1273  }
1274 
1275 
1277  {
1278  toolbox::net::URL url(rcms_->getContextDescriptor()->getURL());
1279  toolbox::net::URL at(xappDesc_->getContextDescriptor()->getURL() + "/" + xappDesc_->getURN());
1280  toolbox::net::URL properurl(url.getProtocol(),url.getHost(),url.getPort(),"");
1281  xdaq::ContextDescriptor *ctxdsc = new xdaq::ContextDescriptor(properurl.toString());
1282  xdaq::ApplicationDescriptor *appdesc = new xdaq::ApplicationDescriptorImpl(ctxdsc,rcms_->getClassName(),rcms_->getLocalId(), "pippo");
1283 
1284  appdesc->setAttribute("path","/rcms/servlet/monitorreceiver");
1285 
1286  xoap::MessageReference msg = xoap::createMessage();
1287  xoap::SOAPEnvelope envelope = msg->getSOAPPart().getEnvelope();
1288  xoap::SOAPName responseName = envelope.createName( "report", xmas::NamespacePrefix, xmas::NamespaceUri);
1289  (void) envelope.getBody().addBodyElement ( responseName );
1290  xoap::SOAPName reportName ("report", xmas::NamespacePrefix, xmas::NamespaceUri);
1291  xoap::SOAPElement reportElement = envelope.getBody().getChildElements(reportName)[0];
1292  reportElement.addNamespaceDeclaration (xmas::sensor::NamespacePrefix, xmas::sensor::NamespaceUri);
1293  xoap::SOAPName sampleName = envelope.createName( "sample", xmas::NamespacePrefix, xmas::NamespaceUri);
1294  xoap::SOAPElement sampleElement = reportElement.addChildElement(sampleName);
1295  xoap::SOAPName flashListName = envelope.createName( "flashlist", "", "");
1296  sampleElement.addAttribute(flashListName,"urn:xdaq-flashlist:scalers");
1297  xoap::SOAPName tagName = envelope.createName( "tag", "", "");
1298  sampleElement.addAttribute(tagName,"tag");
1299  xoap::MimeHeaders* headers = msg->getMimeHeaders();
1300  headers->removeHeader("x-xdaq-tags");
1301  headers->addHeader("x-xdaq-tags", "tag");
1302  tagName = envelope.createName( "originator", "", "");
1303  sampleElement.addAttribute(tagName,at.toString());
1304 
1305  xdata::exdr::AutoSizeOutputStreamBuffer outBuffer;
1306  xdata::exdr::Serializer serializer;
1307  try
1308  {
1309  serializer.exportAll( &scalersComplete_, &outBuffer );
1310  }
1312  {
1313  LOG4CPLUS_WARN(log_,
1314  "Exception in serialization of scalers table");
1315  // localLog("-W- Exception in serialization of scalers table");
1316  throw;
1317  }
1318 
1319  xoap::AttachmentPart * attachment = msg->createAttachmentPart(outBuffer.getBuffer(), outBuffer.tellp(), "application/x-xdata+exdr");
1320  attachment->setContentEncoding("binary");
1321  tagName = envelope.createName( "tag", "", "");
1322  sampleElement.addAttribute(tagName,"tag");
1323  std::stringstream contentId;
1324 
1325  contentId << "<" << "urn:xdaq-flashlist:scalers" << "@" << at.getHost() << ">";
1326  attachment->setContentId(contentId.str());
1327  std::stringstream contentLocation;
1328  contentId << at.toString();
1329  attachment->setContentLocation(contentLocation.str());
1330 
1331  std::stringstream disposition;
1332  disposition << "attachment; filename=" << "urn:xdaq-flashlist:scalers" << ".exdr; creation-date=" << "\"" << "dummy" << "\"";
1333  attachment->addMimeHeader("Content-Disposition",disposition.str());
1334  msg->addAttachmentPart(attachment);
1335 
1336  try{
1337  xappCtxt_->postSOAP(msg,*(xappDesc_),*appdesc);
1338  }
1339  catch(xdaq::exception::Exception &ex)
1340  {
1341  std::string message = "exception when posting SOAP message to MonitorReceiver";
1342  message += ex.what();
1343  LOG4CPLUS_WARN(log_,message.c_str());
1344  std::string lmessage = "-W- "+message;
1345  delete appdesc;
1346  delete ctxdsc;
1347  throw;
1348  // localLog(lmessage);
1349  }
1350  delete appdesc;
1351  delete ctxdsc;
1352  }
1353 }
xdata::InfoSpace * monitorLegendaInfoSpace_
Definition: FWEPWrapper.h:169
xdata::String macro_state_legend_
Definition: FWEPWrapper.h:201
void summaryWebPage(xgi::Input *, xgi::Output *, const std::string &)
Definition: FWEPWrapper.cc:815
T getParameter(std::string const &) const
ShmOutputModuleRegistry * sorRef_
Definition: FWEPWrapper.h:244
std::vector< PathSummary > endPathSummaries
Definition: TriggerReport.h:65
int i
Definition: DBlmapReader.cc:9
unsigned int getfailed(unsigned int ind)
FWEPWrapper(log4cplus::Logger &, unsigned int instance)
Definition: FWEPWrapper.cc:52
std::vector< bool > lumiSectionsTo_
Definition: FWEPWrapper.h:229
#define Input(cl)
Definition: vmac.h:189
event_processor::State getState() const
xdata::String epMState_
Definition: FWEPWrapper.h:184
double getAve(std::string const &name) const
void setIndex(unsigned int lvl1Index)
void updateRollingReport()
TriggerReportStatic * getPackedTriggerReportAsStruct()
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2535
void serviceWeb(xgi::Input *in, xgi::Output *out)
bool checkWeb(const std::string &)
xdata::Integer epmAltState_
Definition: FWEPWrapper.h:197
static PFTauRenderPlugin instance
void moduleWeb(xgi::Input *in, xgi::Output *out)
std::string findLabelOfModuleTypeInEndPath(edm::TriggerReport &, std::vector< edm::ModuleDescription const * > &, unsigned int, std::string)
void startMonitoringWorkLoop()
Definition: FWEPWrapper.cc:614
TrainProcessor *const proc
Definition: MVATrainer.cc:101
virtual std::string explainSelf() const
Definition: Exception.cc:146
void taskWebPage(xgi::Input *, xgi::Output *, const std::string &)
Definition: FWEPWrapper.cc:881
struct timeval monStartTime_
Definition: FWEPWrapper.h:181
ShmOutputModuleRegistry * getShmOutputModuleRegistry()
Definition: FWEPWrapper.cc:491
unsigned int acc
Definition: FWEPWrapper.h:45
void createAndSendScalersMessage()
std::string configString_
Definition: FWEPWrapper.h:152
#define nullptr
void init(unsigned short, std::string &)
Definition: FWEPWrapper.cc:193
xdata::InfoSpace * scalersInfoSpace_
Definition: FWEPWrapper.h:213
xdata::UnsignedInteger32 localLsIncludingTimeOuts_
Definition: FWEPWrapper.h:215
xdaq::ApplicationContext * xappCtxt_
Definition: FWEPWrapper.h:235
xdata::UnsignedInteger32 lastLumiPrescaleIndex_
Definition: FWEPWrapper.h:221
void setupFastTimerService(unsigned int nProcesses)
Definition: FWEPWrapper.cc:497
int lst[30]
xdata::Boolean lsToBeRecovered_
Definition: FWEPWrapper.h:224
void setNumberOfProcesses(unsigned int)
double getFirst(std::string const &name) const
xdata::UnsignedInteger32 & getProcThisLumi()
void sleep(Duration_t)
Definition: Utils.h:163
xdata::InfoSpace * scalersLegendaInfoSpace_
Definition: FWEPWrapper.h:214
std::vector< std::string > mapmod_
Definition: FWEPWrapper.h:176
StatusCode waitTillDoneAsync(unsigned int timeout_seconds=0)
ModuleWebRegistry * mwrRef_
Definition: FWEPWrapper.h:243
std::string const & getMicroState2()
void insertStreamAndDatasetInfo(edm::ParameterSet &streams, edm::ParameterSet &datasets)
void makeServicesOnly()
Definition: FWEPWrapper.cc:479
toolbox::task::WorkLoop * wlMonitoring_
Definition: FWEPWrapper.h:190
static const std::string unknown
Definition: FWEPWrapper.h:146
bool checkLumiSection(unsigned int ls)
int notstarted_state_code_
Definition: FWEPWrapper.h:242
unsigned int getexcept(unsigned int ind)
std::list< std::string > namesScalersLegenda_
Definition: FWEPWrapper.h:208
bool fireScalersUpdate()
Definition: FWEPWrapper.cc:777
xdata::Boolean lsTimedOut_
Definition: FWEPWrapper.h:223
std::vector< PathSummary > trigPathSummaries
Definition: TriggerReport.h:64
static const unsigned int lsRollSize_
Definition: FWEPWrapper.h:232
ModuleWebRegistry * getModuleWebRegistry()
Definition: FWEPWrapper.cc:485
unsigned int lsid_
Definition: FWEPWrapper.h:210
void publish(xdata::InfoSpace *)
void lumiSumTable(xgi::Output *out)
std::vector< std::string > statmod_
Definition: FWEPWrapper.h:177
edm::ServiceToken serviceToken_
Definition: FWEPWrapper.h:149
xdata::String epmState_
Definition: FWEPWrapper.h:185
unsigned int proc
Definition: FWEPWrapper.h:44
bool monitoring(toolbox::task::WorkLoop *wl)
Definition: FWEPWrapper.cc:647
unsigned int psid_
Definition: FWEPWrapper.h:211
void reconfigure(ParameterSet const &ps)
bool isAvailable() const
Definition: Service.h:47
std::string getPathTableAsString() const
bool hasPrescaleService_
Definition: FWEPWrapper.h:160
void openBackDoor(const std::string &, unsigned int timeout_sec=0, bool *started=0)
xdata::UnsignedInteger32 & getAccThisLumi()
int j
Definition: DBlmapReader.cc:9
std::list< std::string > namesStatusLegenda_
Definition: FWEPWrapper.h:207
void publish(xdata::InfoSpace *)
double getMax(std::string const &name) const
xdata::Table scalersComplete_
Definition: FWEPWrapper.h:217
xdata::String micro_state_legend_
Definition: FWEPWrapper.h:202
std::list< std::string > names_
Definition: FWEPWrapper.h:206
unsigned int getl1pre(unsigned int ind)
static ServiceToken createSet(std::vector< ParameterSet > &)
xdata::InfoSpace * monitorInfoSpace_
Definition: FWEPWrapper.h:168
int totalEvents() const
std::map< std::string, int > modmap_
Definition: FWEPWrapper.h:175
char const * stateName(event_processor::State s) const
char const * currentStateName() const
tuple out
Definition: dbtoconf.py:99
unsigned int allPastLumiProcessed_
Definition: FWEPWrapper.h:205
std::vector< edm::ModuleDescription const * > descs_
Definition: FWEPWrapper.h:174
unsigned int getaccept(unsigned int ind)
xdata::UnsignedInteger32 lumiSectionIndex_
Definition: FWEPWrapper.h:219
edm::EventProcessor::StatusCode stop()
Definition: FWEPWrapper.cc:503
xdata::UnsignedInteger32 nbProcessed_
Definition: FWEPWrapper.h:186
boost::shared_ptr< edm::ProcessDesc > processDesc()
void formatReportTable(edm::TriggerReport &, std::vector< edm::ModuleDescription const * > &, std::string &pathIndexTable, bool noNukeLegenda)
bool getTriggerReport(bool useLock)
Definition: FWEPWrapper.cc:694
OutputModule * get(std::string &name)
void closeBackDoor(const std::string &)
log4cplus::Logger log_
Definition: FWEPWrapper.h:158
void packTriggerReport(edm::TriggerReport &, ShmOutputModuleRegistry *, bool)
ServiceToken getToken()
xdata::UnsignedInteger32 lastLumiUsingEol_
Definition: FWEPWrapper.h:222
pthread_mutex_t ep_guard_lock_
Definition: FWEPWrapper.h:241
edm::service::PrescaleService * prescaleSvc_
Definition: FWEPWrapper.h:155
xdata::UnsignedInteger32 instance_
Definition: FWEPWrapper.h:238
xdata::UnsignedInteger32 monSleepSec_
Definition: FWEPWrapper.h:180
void publishConfigAndMonitorItemsSP()
Definition: FWEPWrapper.cc:183
unsigned int scalersUpdateCounter_
Definition: FWEPWrapper.h:227
#define Output(cl)
Definition: vmac.h:193
toolbox::task::ActionSignature * asMonitoring_
Definition: FWEPWrapper.h:191
unsigned int ls
Definition: FWEPWrapper.h:43
xdata::UnsignedInteger32 prescaleSetIndex_
Definition: FWEPWrapper.h:220
unsigned int rollingLsIndex_
Definition: FWEPWrapper.h:230
std::vector< lsTriplet > lumiSectionsCtr_
Definition: FWEPWrapper.h:228
fuep::TriggerReportHelpers trh_
Definition: FWEPWrapper.h:157
edm::EventProcessor * evtProcessor_
Definition: FWEPWrapper.h:147
virtual unsigned int getCounts()=0
xdata::Integer epMAltState_
Definition: FWEPWrapper.h:196
tuple cout
Definition: gather_cfg.py:121
edm::EventSummary eventSummary
std::string lsidTimedOutAsString_
Definition: FWEPWrapper.h:209
bool hasServiceWebRegistry_
Definition: FWEPWrapper.h:162
FastTimerService * ftsRef_
Definition: FWEPWrapper.h:245
void microState(xgi::Input *in, xgi::Output *out)
std::vector< ModuleDescription const * > getAllModuleDescriptions() const
void sumAndPackTriggerReport(MsgBuf &buf)
std::string pathTable_
Definition: FWEPWrapper.h:237
xdaq::ApplicationDescriptor * rcms_
Definition: FWEPWrapper.h:233
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
bool hasModuleWebRegistry_
Definition: FWEPWrapper.h:161
unsigned int scalersUpdateAttempted_
Definition: FWEPWrapper.h:226
int totalEventsPassed() const
xdata::InfoSpace * applicationInfoSpace_
Definition: FWEPWrapper.h:165
xdata::UnsignedInteger32 lsTimeOut_
Definition: FWEPWrapper.h:216
virtual ~FWEPWrapper()
Definition: FWEPWrapper.cc:110
void publishConfigAndMonitorItems(bool)
Definition: FWEPWrapper.cc:112
std::string configuration_
Definition: FWEPWrapper.h:236
bool wlMonitoringActive_
Definition: FWEPWrapper.h:192
void triggerReportUpdate(edm::TriggerReport &, unsigned int, unsigned int, bool=true)
xdaq::ApplicationDescriptor * xappDesc_
Definition: FWEPWrapper.h:234
xdata::UnsignedInteger32 timeoutOnStop_
Definition: FWEPWrapper.h:172
list at
Definition: asciidump.py:428
void publishToXmas(xdata::InfoSpace *)
xdata::UnsignedInteger32 nbAccepted_
Definition: FWEPWrapper.h:187
void getTriggerReport(TriggerReport &rep) const
unsigned int getPrescale(unsigned int lvl1Index, std::string const &prescaledPath)