CMS 3D CMS Logo

SMProxyServer.h

Go to the documentation of this file.
00001 #ifndef _SMProxyServer_h
00002 #define _SMProxyServer_h
00003 
00004 /*
00005    Description:
00006      Storage Manager Proxy Server XDAQ application. 
00007      This receives event data and DQM data from the
00008      Storage Manager of each subfarm. The event data is meant
00009      to be limited to up to a few hertz to serve to event consumers.
00010      The DQM data from all FUs of one update is collated and then
00011      written to disk and also available to send to DQM consumers.
00012 
00013      See CMS EventFilter wiki page for further notes.
00014 
00015    $Id: SMProxyServer.h,v 1.14 2008/10/14 15:02:18 hcheung Exp $
00016 */
00017 
00018 #include <string>
00019 #include <list>
00020 
00021 #include "FWCore/PluginManager/interface/ProblemTracker.h"
00022 #include "FWCore/Utilities/interface/Exception.h"
00023 #include "FWCore/MessageService/interface/MessageServicePresence.h"
00024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00025 
00026 #include "EventFilter/Utilities/interface/Css.h"
00027 #include "EventFilter/Utilities/interface/RunBase.h"
00028 #include "EventFilter/Utilities/interface/StateMachine.h"
00029 
00030 #include "EventFilter/SMProxyServer/interface/DataProcessManager.h"
00031 #include "EventFilter/StorageManager/interface/SMPerformanceMeter.h"
00032 #include "EventFilter/StorageManager/interface/SMFUSenderList.h"
00033 
00034 #include "xdaq/Application.h"
00035 #include "xdaq/ApplicationContext.h"
00036 
00037 #include "xdata/String.h"
00038 #include "xdata/UnsignedInteger32.h"
00039 #include "xdata/Integer.h"
00040 #include "xdata/Double.h"
00041 #include "xdata/Boolean.h"
00042 #include "xdata/Vector.h"
00043 
00044 #include "xgi/Input.h"
00045 #include "xgi/Output.h"
00046 #include "xgi/exception/Exception.h"
00047 
00048 #include "boost/shared_ptr.hpp"
00049 #include "boost/thread/thread.hpp"
00050 
00051 namespace stor {
00052 
00053   class SMProxyServer: public xdaq::Application, 
00054                         public xdata::ActionListener,
00055                         public evf::RunBase
00056   {
00057    public:
00058     SMProxyServer(xdaq::ApplicationStub* s) throw (xdaq::exception::Exception);
00059   
00060     ~SMProxyServer();
00061 
00062     // *** Updates the exported parameters
00063     xoap::MessageReference ParameterGet(xoap::MessageReference message)
00064     throw (xoap::exception::Exception);
00065 
00066     // *** Anything to do with the flash list
00067     void setupFlashList();
00068     void actionPerformed(xdata::Event& e);
00069 
00070     // *** Callbacks to be executed during transitional states
00071     bool configuring(toolbox::task::WorkLoop* wl);
00072     bool enabling(toolbox::task::WorkLoop* wl);
00073     bool stopping(toolbox::task::WorkLoop* wl);
00074     bool halting(toolbox::task::WorkLoop* wl);
00075 
00076     // *** FSM soap command callback
00077     xoap::MessageReference fsmCallback(xoap::MessageReference msg)
00078       throw (xoap::exception::Exception);
00079 
00080     
00082    private:  
00083     void checkDirectoryOK(std::string dir);
00084 
00085     void defaultWebPage
00086       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00087     void css(xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception)
00088       {css_.css(in,out);}
00089     void smsenderWebPage
00090       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00091     void DQMOutputWebPage
00092       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00093     void eventdataWebPage
00094       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00095     void headerdataWebPage
00096       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00097     void consumerWebPage
00098       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00099     void consumerListWebPage
00100       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00101     void eventServerWebPage
00102       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00103     void DQMeventdataWebPage
00104       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00105     void DQMconsumerWebPage
00106       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00107 
00108     void receiveEventWebPage
00109       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00110     void receiveDQMEventWebPage
00111       (xgi::Input *in, xgi::Output *out) throw (xgi::exception::Exception);
00112 
00113     evf::StateMachine fsm_;
00114     std::string reasonForFailedState_;
00115 
00116     edm::AssertHandler *ah_;
00117     edm::service::MessageServicePresence theMessageServicePresence;
00118   
00119     boost::shared_ptr<stor::DataProcessManager> dpm_;
00120     boost::mutex                           halt_lock_;
00121 
00122     //xdata::Integer nLogicalDisk_;
00123     //xdata::String  fileCatalog_;
00124 
00125     //xdata::String  closeFileScript_;
00126     //xdata::String  notifyTier0Script_;
00127     //xdata::String  insertFileScript_;
00128 
00129     //std::string smFileCatalog_;
00130 
00131     xdata::Boolean collateDQM_;
00132     xdata::Boolean archiveDQM_;
00133     xdata::Integer archiveIntervalDQM_;
00134     xdata::String  filePrefixDQM_;
00135     xdata::Integer purgeTimeDQM_;
00136     xdata::Integer readyTimeDQM_;
00137     xdata::Boolean useCompressionDQM_;
00138     xdata::Integer compressionLevelDQM_;
00139 
00140     evf::Css css_;
00141     xdata::UnsignedInteger32 receivedEvents_;
00142     xdata::UnsignedInteger32 receivedDQMEvents_;
00143 
00144     // for Event Server
00145     std::vector<unsigned char> mybuffer_;
00146     xdata::Vector<xdata::String> smRegList_; // StorageManagers to subscribe to
00147     xdata::String consumerName_;
00148     xdata::String DQMconsumerName_;
00149 
00150     xdata::Double maxESEventRate_;  // hertz
00151     xdata::Double maxESDataRate_;  // hertz
00152     xdata::Double maxEventRequestRate_;  // hertz
00153     xdata::Integer activeConsumerTimeout_;  // seconds
00154     xdata::Integer idleConsumerTimeout_;  // seconds
00155     xdata::Integer consumerQueueSize_;
00156     xdata::Boolean fairShareES_;
00157     xdata::Double DQMmaxESEventRate_;  // hertz
00158     xdata::Double maxDQMEventRequestRate_;  // hertz
00159     xdata::Integer DQMactiveConsumerTimeout_;  // seconds
00160     xdata::Integer DQMidleConsumerTimeout_;  // seconds
00161     xdata::Integer DQMconsumerQueueSize_;
00162     xdata::String esSelectedHLTOutputModule_;
00163 
00164     std::map< std::string, bool > smsenders_;
00165     xdata::UnsignedInteger32 connectedSMs_;
00166 
00167     xdata::UnsignedInteger32 storedDQMEvents_;
00168     xdata::UnsignedInteger32 sentEvents_;
00169     xdata::UnsignedInteger32 sentDQMEvents_;
00170     //xdata::UnsignedInteger32 closedFiles_;
00171     //xdata::Vector<xdata::String> fileList_;
00172     //xdata::Vector<xdata::UnsignedInteger32> eventsInFile_;
00173     //xdata::Vector<xdata::UnsignedInteger32> fileSize_;
00174 
00175     // *** for performance measurements
00176     void addMeasurement(unsigned long size);
00177     void addOutMeasurement(unsigned long size);
00178     stor::SMPerformanceMeter *outpmeter_;
00179 
00180     // *** measurements for last set of samples
00181     xdata::UnsignedInteger32 samples_; // number of samples/frames per measurement
00182     xdata::Double instantBandwidth_; // bandwidth in MB/s
00183     xdata::Double instantRate_;      // number of frames/s
00184     xdata::Double instantLatency_;   // micro-seconds/frame
00185     xdata::Double maxBandwidth_;     // maximum bandwidth in MB/s
00186     xdata::Double minBandwidth_;     // minimum bandwidth in MB/s
00187     xdata::Double outinstantBandwidth_; // bandwidth in MB/s
00188     xdata::Double outinstantRate_;      // number of frames/s
00189     xdata::Double outinstantLatency_;   // micro-seconds/frame
00190     xdata::Double outmaxBandwidth_;     // maximum bandwidth in MB/s
00191     xdata::Double outminBandwidth_;     // minimum bandwidth in MB/s
00192     xdata::Double receivedVolume_;      // volume of data received
00193     xdata::Double outreceivedVolume_;   // volume of data sent
00194 
00195     // *** measurements for all samples
00196     xdata::Double duration_;         // time for run in seconds
00197     xdata::UnsignedInteger32 totalSamples_; //number of samples/frames per measurement
00198     xdata::Double meanBandwidth_;    // bandwidth in MB/s
00199     xdata::Double meanRate_;         // number of frames/s
00200     xdata::Double meanLatency_;      // micro-seconds/frame
00201     xdata::Double outduration_;         // time for run in seconds
00202     xdata::UnsignedInteger32 outtotalSamples_; //number of samples/frames per measurement
00203     xdata::Double outmeanBandwidth_;    // bandwidth in MB/s
00204     xdata::Double outmeanRate_;         // number of frames/s
00205     xdata::Double outmeanLatency_;      // micro-seconds/frame
00206 
00207     // *** measurements for time period based statistics
00208     xdata::UnsignedInteger32 period4samples_; // time period for measurements
00209     xdata::Double instantBandwidth2_; // bandwidth in MB/s
00210     xdata::Double instantRate2_;      // number of frames/s
00211     xdata::Double instantLatency2_;   // micro-seconds/frame
00212     xdata::Double maxBandwidth2_;     // maximum bandwidth in MB/s
00213     xdata::Double minBandwidth2_;     // minimum bandwidth in MB/s
00214     xdata::Double outinstantBandwidth2_; // bandwidth in MB/s
00215     xdata::Double outinstantRate2_;      // number of frames/s
00216     xdata::Double outinstantLatency2_;   // micro-seconds/frame
00217     xdata::Double outmaxBandwidth2_;     // maximum bandwidth in MB/s
00218     xdata::Double outminBandwidth2_;     // minimum bandwidth in MB/s
00219 
00220     // *** measurements for all samples
00221     xdata::Double duration2_;         // time for run in seconds
00222     xdata::UnsignedInteger32 totalSamples2_; //number of samples/frames per measurement
00223     xdata::Double meanBandwidth2_;    // bandwidth in MB/s
00224     xdata::Double meanRate2_;         // number of frames/s
00225     xdata::Double meanLatency2_;      // micro-seconds/frame
00226     xdata::Double outduration2_;         // time for run in seconds
00227     xdata::UnsignedInteger32 outtotalSamples2_; //number of samples/frames per measurement
00228     xdata::Double outmeanBandwidth2_;    // bandwidth in MB/s
00229     xdata::Double outmeanRate2_;         // number of frames/s
00230     xdata::Double outmeanLatency2_;      // micro-seconds/frame
00231 
00232     // *** additional flashlist contents (rest was already there)
00233     xdata::String            class_;
00234     xdata::UnsignedInteger32 instance_;
00235     xdata::String            url_;       
00236 
00237     xdata::Double            storedVolume_;
00238     xdata::UnsignedInteger32 memoryUsed_;
00239     xdata::String            progressMarker_;
00240     enum
00241     {
00242       DEFAULT_PURGE_TIME = 120,
00243       DEFAULT_READY_TIME = 30
00244     };
00245   }; 
00246 } 
00247 
00248 
00249 #endif

Generated on Tue Jun 9 17:34:51 2009 for CMSSW by  doxygen 1.5.4