CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FUEventProcessor.h
Go to the documentation of this file.
1 #ifndef FUEVENTPROCESSOR_H
2 #define FUEVENTPROCESSOR_H 1
3 
10 
16 #include "SubProcess.h"
17 #include "FWEPWrapper.h"
18 
21 
22 #include "xdaq/Application.h"
23 #include "xdaq/NamespaceURI.h"
24 
25 #include "xdata/String.h"
26 #include "xdata/Integer.h"
27 #include "xdata/Boolean.h"
28 #include "xdata/Vector.h"
29 #include "xdata/UnsignedInteger32.h"
30 #include "xdata/ActionListener.h"
31 #include "xdata/InfoSpaceFactory.h"
32 
33 #include "xgi/Input.h"
34 #include "xgi/Output.h"
35 #include "xgi/exception/Exception.h"
36 
37 #include <sys/time.h>
38 #include <pthread.h>
39 #include <sys/resource.h>
40 #include <signal.h>
41 
42 #include <list>
43 #include <vector>
44 #include <map>
45 
46 namespace evf
47 {
48 
49  /* to be filled in with summary from paths */
50  struct filter {
51 
52  };
53  class CPUStat;
54  class RateStat;
55  namespace internal{
56 
57  class MyCgi : public xgi::Input{
58  public:
59  MyCgi() : xgi::Input("",0){}
60  // MyCgi(xgi::Input &b) : xgi::Input("",0) {environment_ = b.environment_;}
61  std::map<std::string, std::string, std::less<std::string> > &getEnvironment(){return environment_;}
62  };
63  }
64  class FUEventProcessor : public xdaq::Application,
65  public xdata::ActionListener
66  {
67  public:
68  //
69  // construction/destruction
70  //
72  FUEventProcessor(xdaq::ApplicationStub *s);
73  virtual ~FUEventProcessor();
74 
75 
76  //
77  // member functions
78  //
79 
80  // work loop functions to be executed during transitional states (async)
81  bool configuring(toolbox::task::WorkLoop* wl);
82  bool enabling(toolbox::task::WorkLoop* wl);
83  bool stopping(toolbox::task::WorkLoop* wl);
84  bool halting(toolbox::task::WorkLoop* wl);
85 
86  // fsm soap command callback
87  xoap::MessageReference fsmCallback(xoap::MessageReference msg)
89 
90  // xdata:ActionListener interface
91  void actionPerformed(xdata::Event& e);
92 
93  // trigger report related helper functions
94  // std::string triggerReportToString(const edm::TriggerReport& tr);
95  // void triggerReportToTable(const edm::TriggerReport& tr);
96  // void printTriggerReport(const edm::TriggerReport& tr);
97 
98  // HyperDAQ related functions
108  {
109  css_.css(in,out);
110  }
111 
120 
121  static void forkProcessFromEDM_helper(void * addr);
122  void handleSignalSlave(int sig, siginfo_t* info, void* c);
123 
124  private:
125 
126 
127  void forkProcessesFromEDM();
128 
129  bool enableForkInEDM();
130  bool restartForkInEDM(unsigned int slotId);
131  bool doEndRunInEDM();
132 
133  void setAttachDqmToShm() throw (evf::Exception);
134  void attachDqmToShm() throw (evf::Exception);
135  void detachDqmFromShm() throw (evf::Exception);
136 
137  std::string logsAsString();
138  void localLog(std::string);
139 
140  // MPEP functions
141  void startSupervisorLoop();
142  void startReceivingLoop();
144  // calculate scalers information in separate thread
145  void startScalersWorkLoop() throw (evf::Exception);
146  bool scalers(toolbox::task::WorkLoop* wl);
147  void startSummarizeWorkLoop() throw (evf::Exception);
148  bool summarize(toolbox::task::WorkLoop* wl);
149 
150  bool receiving(toolbox::task::WorkLoop* wl);
151  bool receivingAndMonitor(toolbox::task::WorkLoop* wl);
152  bool supervisor(toolbox::task::WorkLoop* wl);
153  void startSignalMonitorWorkLoop() throw (evf::Exception);
154  bool sigmon(toolbox::task::WorkLoop* wl);
155 
156  bool enableCommon();
157  bool enableClassic();
158  // void enableMPEPMaster();
159  bool enableMPEPSlave();
160  bool stopClassic();
162  void makeStaticInfo();
163 
164  //
165  // member data
166  //
167 
168  // finite state machine
170 
171  // logger
172  Logger log_;
173 
174  // edm event processor
176 
177  // parameters published to XDAQ info space(s)
178  xdata::String url_;
179  xdata::String class_;
180  xdata::UnsignedInteger32 instance_;
181  xdata::UnsignedInteger32 runNumber_;
182  xdata::Boolean epInitialized_;
183  xdata::String configString_;
184  std::string configuration_;
185 
186  xdata::Boolean outPut_;
187 
188  xdata::Boolean autoRestartSlaves_;
189  xdata::UnsignedInteger32 slaveRestartDelaySecs_;
190 
191  xdata::Boolean hasShMem_;
192  xdata::Boolean hasPrescaleService_;
193  xdata::Boolean hasModuleWebRegistry_;
194  xdata::Boolean hasServiceWebRegistry_;
195  xdata::Boolean isRunNumberSetter_;
196  xdata::Boolean iDieStatisticsGathering_;
197  bool outprev_;
198 
199  // application identifier
200  std::string sourceId_;
201 
202  // flashlist variables, squids
203  xdata::Boolean squidPresent_;
204 
205  // behavior on error - configurable
206 
207  xdata::Boolean exitOnError_;
208 
209  // HyperDAQ related
211 
212  // Misc
214 
216  std::vector<std::string> logRing_;
217  unsigned int logRingIndex_;
218  static const unsigned int logRingSize_ = 50;
219  bool logWrap_;
220 
221  xdata::UnsignedInteger32 nbSubProcesses_;
222  xdata::UnsignedInteger32 nbSubProcessesReporting_;
223  xdata::UnsignedInteger32 forkInEDM_;
224  std::vector<SubProcess> subs_;
225  unsigned int nblive_;
226  unsigned int nbdead_;
227 
228  unsigned int nbTotalDQM_;
229 
230  // workloop / action signature for message passing
231  toolbox::task::WorkLoop *wlReceiving_;
232  toolbox::task::ActionSignature *asReceiveMsgAndExecute_;
234  toolbox::task::WorkLoop *wlReceivingMonitor_;
235  toolbox::task::ActionSignature *asReceiveMsgAndRead_;
238  toolbox::task::WorkLoop *wlSupervising_;
239  toolbox::task::ActionSignature *asSupervisor_;
241  toolbox::task::WorkLoop *wlSignalMonitor_;
242  toolbox::task::ActionSignature *asSignalMonitor_;
244 
245 
246  xdata::InfoSpace* monitorInfoSpace_;
247  xdata::InfoSpace* monitorLegendaInfoSpace_;
248  xdata::InfoSpace* applicationInfoSpace_;
249  pthread_mutex_t stop_lock_;
250  pthread_mutex_t start_lock_;
251  pthread_mutex_t pickup_lock_;
252  std::string updaterStatic_;
253  xdata::Serializable *nbProcessed;
254  xdata::Serializable *nbAccepted;
255 
256  // flahslist variables, scalers
257  xdata::InfoSpace *scalersInfoSpace_;
258  xdata::InfoSpace *scalersLegendaInfoSpace_;
259 
260  //scalers workloop
261  toolbox::task::WorkLoop *wlScalers_;
262  toolbox::task::ActionSignature *asScalers_;
264  unsigned int scalersUpdates_;
265 
266  //summarize workloop
267  toolbox::task::WorkLoop *wlSummarize_;
268  toolbox::task::ActionSignature *asSummarize_;
271  xdata::Vector<xdata::Integer> spMStates_;
272  xdata::Vector<xdata::Integer> spmStates_;
273  xdata::UnsignedInteger32 superSleepSec_;
274  std::list<std::string> names_;
275  xdata::String iDieUrl_;
277  pid_t vp_;
280 
288 
289  moduleweb::ForkInfoObj *forkInfoObj_;
290  pthread_mutex_t forkObjLock_;
293 
294  unsigned int crashesThisRun_;
297  xdata::UnsignedInteger32 crashesToDump_;
298  sem_t *sigmon_sem_;
299  timeval lastCrashTime_;
300 
301  unsigned long long idleProcStats_;
302  unsigned long long allProcStats_;
304 
305  std::auto_ptr<edm::Presence> messageServicePresence_;
306  xdata::Boolean datasetCounting_;
307  };
308 
309 
310 } // namespace evf
311 
312 
313 #endif
xdata::Boolean hasModuleWebRegistry_
ShmOutputModuleRegistry * sorRef_
void spotlightWebPage(xgi::Input *, xgi::Output *)
xdata::Vector< xdata::Integer > spMStates_
xdata::InfoSpace * monitorInfoSpace_
void subWeb(xgi::Input *in, xgi::Output *out)
#define Input(cl)
Definition: vmac.h:189
std::vector< std::string > logRing_
bool receivingAndMonitor(toolbox::task::WorkLoop *wl)
xdata::UnsignedInteger32 slaveRestartDelaySecs_
xdata::Boolean datasetCounting_
xdata::UnsignedInteger32 runNumber_
void updater(xgi::Input *in, xgi::Output *out)
toolbox::task::WorkLoop * wlScalers_
void serviceWeb(xgi::Input *in, xgi::Output *out)
pthread_mutex_t start_lock_
void moduleWeb(xgi::Input *in, xgi::Output *out)
std::map< std::string, std::string, std::less< std::string > > & getEnvironment()
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
xdata::UnsignedInteger32 crashesToDump_
bool restartForkInEDM(unsigned int slotId)
xdata::Boolean isRunNumberSetter_
xdata::UnsignedInteger32 forkInEDM_
xdata::Boolean hasServiceWebRegistry_
toolbox::task::WorkLoop * wlReceiving_
xdata::Boolean hasShMem_
toolbox::task::ActionSignature * asReceiveMsgAndExecute_
toolbox::task::ActionSignature * asSignalMonitor_
xdata::InfoSpace * scalersLegendaInfoSpace_
toolbox::task::ActionSignature * asSupervisor_
xdata::Boolean autoRestartSlaves_
xdata::UnsignedInteger32 nbSubProcessesReporting_
unsigned int crashesThisRun_
void css(xgi::Input *in, xgi::Output *out)
toolbox::task::ActionSignature * asReceiveMsgAndRead_
xdata::Boolean exitOnError_
std::vector< SubProcess > subs_
xdata::InfoSpace * monitorLegendaInfoSpace_
bool summarize(toolbox::task::WorkLoop *wl)
void getSlavePids(xgi::Input *in, xgi::Output *out)
xdata::Serializable * nbProcessed
xoap::MessageReference fsmCallback(xoap::MessageReference msg)
pthread_mutex_t forkObjLock_
bool halting(toolbox::task::WorkLoop *wl)
evf::StateMachine fsm_
bool scalers(toolbox::task::WorkLoop *wl)
toolbox::task::WorkLoop * wlSupervising_
std::string reasonForFailedState_
FUEventProcessor(xdaq::ApplicationStub *s)
unsigned long long idleProcStats_
xdata::Boolean iDieStatisticsGathering_
bool sigmon(toolbox::task::WorkLoop *wl)
void css(xgi::Input *in, xgi::Output *out)
Definition: Css.h:15
void scalersWeb(xgi::Input *, xgi::Output *)
xdata::Boolean squidPresent_
std::list< std::string > names_
Definition: Css.h:12
xdata::Boolean hasPrescaleService_
void handleSignalSlave(int sig, siginfo_t *info, void *c)
bool receiving(toolbox::task::WorkLoop *wl)
bool stopping(toolbox::task::WorkLoop *wl)
void procStat(xgi::Input *in, xgi::Output *out)
moduleweb::ForkInfoObj * forkInfoObj_
toolbox::task::WorkLoop * wlSummarize_
xdata::Serializable * nbAccepted
tuple out
Definition: dbtoconf.py:99
void localLog(std::string)
static void forkProcessFromEDM_helper(void *addr)
ModuleWebRegistry * mwrRef_
bool configuring(toolbox::task::WorkLoop *wl)
xdata::InfoSpace * applicationInfoSpace_
xdata::UnsignedInteger32 nbSubProcesses_
bool enabling(toolbox::task::WorkLoop *wl)
unsigned int scalersUpdates_
xdata::String configString_
xdata::UnsignedInteger32 superSleepSec_
string const
Definition: compareJSON.py:14
unsigned long long allProcStats_
std::auto_ptr< edm::Presence > messageServicePresence_
void sendMessageOverMonitorQueue(MsgBuf &)
void moduleWeb(xgi::Input *in, xgi::Output *out)
void pathNames(xgi::Input *, xgi::Output *)
#define Output(cl)
Definition: vmac.h:193
pthread_mutex_t pickup_lock_
void defaultWebPage(xgi::Input *in, xgi::Output *out)
toolbox::task::ActionSignature * asSummarize_
toolbox::task::WorkLoop * wlSignalMonitor_
xdata::Vector< xdata::Integer > spmStates_
xdata::UnsignedInteger32 instance_
void serviceWeb(xgi::Input *in, xgi::Output *out)
toolbox::task::WorkLoop * wlReceivingMonitor_
toolbox::task::ActionSignature * asScalers_
bool supervisor(toolbox::task::WorkLoop *wl)
pthread_mutex_t stop_lock_
xdata::InfoSpace * scalersInfoSpace_
void actionPerformed(xdata::Event &e)
void microState(xgi::Input *in, xgi::Output *out)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
static const unsigned int logRingSize_
xdata::Boolean epInitialized_