Gaudi Framework, version v21r11

Home   Generated: 30 Sep 2010

DataListenerSvc.cpp

Go to the documentation of this file.
00001 // $Id: DataListenerSvc.cpp,v 1.6 2008/10/27 19:22:21 marcocle Exp $
00002 // Include files
00003 #include "GaudiKernel/IAlgorithm.h"
00004 #include "GaudiKernel/IAlgTool.h"
00005 #include "GaudiKernel/Service.h"
00006 #include "GaudiKernel/SvcFactory.h"
00007 #include "GaudiKernel/MsgStream.h"
00008 #include "GaudiKernel/IIncidentSvc.h"
00009 #include "DataListenerSvc.h"
00010 #include "ValueMap.h"
00011 #include "XmlCode.h"
00012 #ifdef _WIN32
00013 #define NOMSG
00014 #define NOGDI
00015 #include <windows.h>
00016 #include <winsock.h>
00017 #include <process.h>
00018 #undef NOMSG
00019 #undef NOGDI
00020 #else
00021 #include <unistd.h>
00022 #include <exception>
00023 #endif
00024 #include <sys/types.h>
00025 
00026 /********************************************
00027  *
00028  * This program implements DataListenerSvc.h which supplies a handle method for the declareInfo service.
00029  * Given options in the optsfile, txt and XML files containing the variable names and their values
00030  * are written out for the last read record specified by the user.
00031  *
00032  * Currently there are no undeclare or getInfo methods
00033  *
00034  * Author: Ben King
00035  *
00036  ********************************************/
00037 
00038 
00039 // Factory for instantiation of service objects
00040 DECLARE_SERVICE_FACTORY(DataListenerSvc)
00041 
00042 namespace  {
00043   // num of Incidents counter
00044   int numIncidents = 0;
00045   int defaultMLFrequency = 100;
00046   int defaultjobID = 0;
00047   std::string defaultClusterName = "DataListenerSvc";
00048   std::string defaultApMonSettingsFile = "http://ganga.web.cern.ch/ganga/monalisa.conf";
00049   int defaultMonALISAMonitoring = 1;
00050   int defaultXMLMonitoring = 1;
00051   int defaultFileMonitoring = 1;
00052 
00053   // fileNum counter
00054   int fileCounter = 0;
00055   int defaultFrequency = 100;
00056 }
00057 
00058 // Constructor
00059 DataListenerSvc::DataListenerSvc(const std::string& name, ISvcLocator* sl)
00060   : base_class(name, sl) {
00061 
00062   declareProperty ("EventFrequency", m_EventFrequency=defaultFrequency);
00063   declareProperty ("MLEventFrequency", m_MLEventFrequency=defaultMLFrequency);
00064   declareProperty ("MLjobID", m_MLjobID=defaultjobID);
00065   declareProperty ("MLClusterName", m_MLClusterName=defaultClusterName);
00066   declareProperty ("MonALISAMonitoring", m_MonALISAMonitoring=defaultMonALISAMonitoring);
00067   declareProperty ("ApMonSource", m_ApMonSettingsFile=defaultApMonSettingsFile);
00068 
00069   declareProperty ("XMLMonitoring", m_XMLMonitoring=defaultXMLMonitoring);
00070   declareProperty ("FileMonitoring", m_FileMonitoring=defaultFileMonitoring);
00071 
00072 }
00073 
00074 // implement Service methods
00075 StatusCode DataListenerSvc::initialize()
00076 {
00077 
00078   m_ApMonSettingsFile = defaultApMonSettingsFile;
00079   StatusCode sc = Service::initialize();
00080   MsgStream msg(msgSvc(),name());
00081 
00082   jobIDString = "jobID: " + stringConverter(m_MLjobID);
00083 
00084   if ( !sc.isSuccess() )   {
00085     msg << MSG::ERROR << "Failed to initialize Service base class." << endmsg;
00086     return StatusCode::FAILURE;
00087   }
00088 
00089   sc = service("IncidentSvc", m_incidentSvc, true);
00090   if (!sc.isSuccess()) {
00091     msg << MSG::ERROR << "Failed to access incident service." << endmsg;
00092     return StatusCode::FAILURE;
00093   }
00094   m_incidentSvc->addListener(this, IncidentType::EndEvent);
00095 
00096   if (m_MonALISAMonitoring){
00097     // Initialise MonALISA
00098     apm = new ApMon(const_cast<char*>(m_ApMonSettingsFile.c_str()));
00099   }
00100 
00101   // DEBUG info on job options specified in GAUDI
00102   if (m_MLEventFrequency == defaultMLFrequency) {
00103     msg << MSG::DEBUG
00104         << "Frequency to send data to MonALISA not specified, taken as the default value: "
00105         << defaultMLFrequency << endmsg;
00106   } else {
00107     msg << MSG::INFO
00108         << "Data sent to MonALISA every "
00109         << m_MLEventFrequency << " events" << endmsg;
00110   }
00111 
00112   if (m_MLjobID == defaultjobID){
00113     msg << MSG::DEBUG
00114         << "DataListenerSvc MonALISA Job ID not specified, taken as the default value: "
00115         << defaultjobID << endmsg;
00116   }
00117 
00118   if (m_MLClusterName == defaultClusterName){
00119     msg << MSG::DEBUG
00120         << "DataListenerSvc MonALISA cluster name not specified, taken as the default value: "
00121         << defaultClusterName << endmsg;
00122   }
00123 
00124   if (m_ApMonSettingsFile == defaultApMonSettingsFile){
00125     msg << MSG::DEBUG
00126         << "MonALISA ApMon configuration file destination not specified,  will be read from: "
00127         << defaultClusterName << endmsg;
00128   }
00129 
00130   if (m_EventFrequency == defaultFrequency){
00131     msg << MSG::INFO
00132         << "XML Log file frequency not specified, taken as the default value: "
00133         << defaultFrequency << endmsg;
00134   } else {
00135     msg << MSG::INFO
00136         << "Frequency XML logs are written at: "
00137         << m_EventFrequency << endmsg;
00138   }
00139 
00140   if (m_MonALISAMonitoring) {
00141     msg << MSG::INFO
00142         << "Data will be published to a MonALISA server"
00143         << endmsg;
00144   }
00145 
00146   if (m_XMLMonitoring) {
00147     msg << MSG::INFO
00148         << "Data will be written to XML log files"
00149         << endmsg;
00150   }
00151   if (m_FileMonitoring) {
00152     msg << MSG::INFO
00153         << "Data will be updated in a Text log file"
00154         << endmsg;
00155   }
00156 
00157   return StatusCode::SUCCESS;
00158 }
00159 
00160 
00161 StatusCode DataListenerSvc::finalize()
00162 {
00163   MsgStream msg(msgSvc(),"DataListenerSvc");
00164 
00165   m_infoDescriptions.clear();
00166   m_ValNamesMap.clear();
00167 
00168   if (m_MonALISAMonitoring){
00169     if ( 0!= apm ) {
00170       delete apm;
00171       apm = 0 ;
00172     }
00173   }
00174 
00175   msg << MSG::DEBUG << "ApMon deleted" << endmsg;
00176   msg << MSG::INFO << "finalized successfully" << endmsg;
00177 
00178   if( m_incidentSvc ) m_incidentSvc->release();
00179 
00180   return Service::finalize();
00181 }
00182 
00183 void DataListenerSvc::declareInfo(const std::string& name, const double& var,
00184                                   const std::string& /*desc*/,
00185                                   const IInterface* /*owner*/)
00186 {
00187   ValueMap::m_type vartype;
00188   vartype = ValueMap::m_double;
00189 
00190   MsgStream msg(msgSvc(),"DataListenerSvc");
00191 
00192   // In the ValueMap, store the pointer to the data (converted to void*)
00193   // and also store the pointer type (with an enum) so it can be converted back
00194   m_ValueMap.set_ptr(  static_cast <void*> (const_cast <double*> (&var) )  );
00195   m_ValueMap.set_ptrType(vartype);
00196 
00197   Entry p1(name, m_ValueMap);
00198 
00199   // m_ValNamesMap is then composed of n (variable Name: ValueMap) pairs
00200   m_ValNamesMap.insert(p1);
00201 
00202 }
00203 
00204 void DataListenerSvc::declareInfo(const std::string& name, const long& var,
00205                                   const std::string& /*desc*/,
00206                                   const IInterface* /*owner*/)
00207 {
00208 
00209   ValueMap::m_type vartype;
00210   vartype = ValueMap::m_long;
00211 
00212   MsgStream msg(msgSvc(),"DataListenerSvc");
00213 
00214   m_ValueMap.set_ptr(  static_cast <void*> (const_cast <long*> (&var) )  );
00215   m_ValueMap.set_ptrType(vartype);
00216 
00217   Entry p1(name, m_ValueMap);
00218 
00219   m_ValNamesMap.insert(p1);
00220 
00221 }
00222 
00223 void DataListenerSvc::declareInfo(const std::string& name, const int& var,
00224                                   const std::string& /*desc*/,
00225                                   const IInterface* /*owner*/)
00226 {
00227   ValueMap::m_type vartype;
00228   vartype = ValueMap::m_int;
00229 
00230   MsgStream msg(msgSvc(),"DataListenerSvc");
00231 
00232   m_ValueMap.set_ptr(  static_cast <void*> (const_cast <int*> (&var) )  );
00233   m_ValueMap.set_ptrType(vartype);
00234 
00235   Entry p1(name, m_ValueMap);
00236 
00237   m_ValNamesMap.insert(p1);
00238 
00239 }
00240 
00241 void DataListenerSvc::declareInfo(const std::string& name, const bool& var,
00242                                   const std::string& /*desc*/,
00243                                   const IInterface* /*owner*/)
00244 {
00245 
00246   ValueMap::m_type vartype;
00247   vartype = ValueMap::m_bool;
00248 
00249   MsgStream msg(msgSvc(),"DataListenerSvc");
00250 
00251   m_ValueMap.set_ptr(  static_cast <void*> (const_cast <bool*> (&var) )  );
00252   m_ValueMap.set_ptrType(vartype);
00253 
00254   Entry p1(name, m_ValueMap);
00255 
00256   m_ValNamesMap.insert(p1);
00257 
00258 }
00259 
00260 void DataListenerSvc::declareInfo(const std::string& name,
00261                                   const std::string& var,
00262                                   const std::string& /*desc*/,
00263                                   const IInterface* /*owner*/)
00264 {
00265   ValueMap::m_type vartype;
00266   vartype = ValueMap::m_string;
00267 
00268   MsgStream msg(msgSvc(),"DataListenerSvc");
00269 
00270   m_ValueMap.set_ptr(  static_cast <void*> (const_cast <std::string*> (&var) )  );  m_ValueMap.set_ptrType(vartype);
00271 
00272   Entry p1(name, m_ValueMap);
00273 
00274   m_ValNamesMap.insert(p1);
00275 
00276 }
00277 
00278 void DataListenerSvc::declareInfo(const std::string& /*name*/,
00279                                   const std::pair<double,double>& /*var*/,
00280                                   const std::string& /*desc*/,
00281                                   const IInterface* /*owner*/)
00282 {
00283 }
00284 
00285 void DataListenerSvc::declareInfo(const std::string& /*name*/,
00286                                   const StatEntity& /*var*/,
00287                                   const std::string& /*desc*/,
00288                                   const IInterface* /*owner*/)
00289 {
00290 }
00291 
00292 void DataListenerSvc::declareInfo(const std::string& /*name*/,
00293                                   const AIDA::IBaseHistogram* /*var*/,
00294                                   const std::string& /*desc*/,
00295                                   const IInterface* /*owner*/)
00296 {
00297 }
00298 
00299 void DataListenerSvc::declareInfo(const std::string& /*name*/,
00300                                   const std::string& /*format*/,
00301                                   const void* /*var*/,
00302                                   int /*size*/,
00303                                   const std::string& /*desc*/,
00304                                   const IInterface* /*owner*/)
00305 {
00306 }
00307 
00308 void DataListenerSvc::undeclareInfo( const std::string& /*name*/,
00309                                      const IInterface* /*owner*/ )
00310 {
00311 }
00312 
00313 void DataListenerSvc::undeclareAll( const IInterface* /*owner*/ )
00314 {
00315 }
00316 
00317 std::set<std::string> * DataListenerSvc::getInfos(const IInterface* /*owner*/ )
00318 {
00319   std::set<std::string> * returnData = NULL;
00320   return returnData;
00321 }
00322 
00323 std::string DataListenerSvc::infoOwnerName( const IInterface* /*owner*/ )
00324 {
00325   std::string returnData = "";
00326   return returnData;
00327 }
00328 
00329 void DataListenerSvc::handle (const Incident& Inc)
00330 {
00331 
00332   MsgStream msg(msgSvc(),"DataListenerSvc");
00333   numIncidents++;
00334 
00335 
00336   if (numIncidents % m_EventFrequency == 0){
00337 
00338     try {
00339       Log4.open("MonitorLog.txt", std::ios::trunc);
00340       XMLLog.open(("./log" + stringConverter(fileCounter)  + ".xml").c_str() , std::ios::trunc);
00341     } catch(std::exception /*&e*/) {
00342       msg << MSG::INFO
00343           << "Log File could not be opened, no monitoring available"
00344           << endmsg;
00345     }
00346 
00347     if (m_MonALISAMonitoring){
00348       // Send Data to MonALISA
00349       sendData(&m_ValNamesMap);
00350     }
00351 
00352     if (m_FileMonitoring){
00353       // Write simple text log
00354       writeMap(&m_ValNamesMap, Inc, &Log4 );
00355       Log4.close();
00356     }
00357 
00358     if (m_XMLMonitoring){
00359       // Write XML files
00360       writeXML(&m_ValNamesMap, Inc, &XMLLog );
00361       XMLLog.close();
00362     }
00363 
00364     fileCounter++;
00365   }
00366 
00367 }
00368 
00369 // With a String as argument, resize with whitespace until specified length
00370 std::string DataListenerSvc::resizeString ( const std::string text,
00371                                             const unsigned int length)
00372 {
00373   std::string temp;
00374   unsigned int counter=0;
00375 
00376   do {
00377 
00378     if (text.length() > length) {
00379       temp = text.substr(0,(length-1));
00380     } else {
00381       if (counter==0) {
00382         temp = text;
00383         counter++;
00384       }
00385       temp.append(" ");
00386     }
00387 
00388   } while (temp.length() != length);
00389 
00390   return temp;
00391 }
00392 
00393 // Convert argument to a string so that can format for text file
00394 std::string DataListenerSvc::stringConverter (const int convertee)
00395 {
00396   std::stringstream s;
00397   std::string temp;
00398   s << convertee;
00399   s >> temp;
00400   s.flush();
00401   return temp;
00402 }
00403 
00404 std::string DataListenerSvc::stringConverter (const double convertee)
00405 {
00406   std::stringstream s;
00407   std::string temp;
00408   s << convertee;
00409   s >> temp;
00410   s.flush();
00411   return temp;
00412 }
00413 
00414 std::string DataListenerSvc::stringConverter (const long convertee)
00415 {
00416   std::stringstream s;
00417   std::string temp;
00418   s << convertee;
00419   s >> temp;
00420   s.flush();
00421   return temp;
00422 }
00423 
00424 std::string DataListenerSvc::stringConverter (const bool convertee)
00425 {
00426   std::stringstream s;
00427   std::string temp;
00428   s << convertee;
00429   s >> temp;
00430   s.flush();
00431   return temp;
00432 }
00433 
00434 
00435 void DataListenerSvc::writeXML(ValNamesMap* m_ValNamesMap,
00436                                const Incident& Inc,
00437                                std::ofstream* MyFile)
00438 {
00439 
00440   MsgStream msg(msgSvc(),"DataListenerSvc");
00441 
00442   // prepare time ctime.h and remove trailing carriage return
00443   time ( &rawTime );
00444   sprintf (buffer, "%s", ctime(&rawTime));
00445   timeDate = buffer;
00446   timeDate.erase(timeDate.size()-1, 1);
00447 
00448 
00449   msg << MSG::INFO << "XML written to file: " << MyFile << endmsg;
00450 
00451 
00452   *MyFile << xml.declaration("1.0", "ASCII", "yes") << std::endl;
00453 
00454   *MyFile << xml.tagBegin("Results", 0, "Time", timeDate)
00455           << xml.tagBegin("Run",1);
00456 
00457 
00458   for (m_ValNamesMapIt = m_ValNamesMap->begin();
00459        m_ValNamesMapIt != m_ValNamesMap->end();
00460        ++m_ValNamesMapIt) {
00461 
00462     m_ValueMapTemp = m_ValNamesMapIt->second;
00463 
00464     *MyFile << xml.tagBegin("Incident",2);
00465 
00466     *MyFile << xml.tagBegin("IncType", 3)
00467             << xml.data(resizeString(Inc.type(),18))
00468             << xml.tagEnd("IncType", 0);
00469 
00470     *MyFile << xml.tagBegin("IncSource", 3)
00471             << xml.data(resizeString(Inc.source(),18))
00472             << xml.tagEnd("IncSource", 0);
00473 
00474     *MyFile << xml.tagBegin("VarName", 3)
00475             << xml.data(resizeString(m_ValNamesMapIt->first,20))
00476             << xml.tagEnd("VarName", 0);
00477 
00478     *MyFile << xml.tagBegin("Value", 3, "Result", stringConverter(numIncidents));
00479     // Check the variable type and in each case, cast accordingly
00480 
00481 
00482 
00483     // re-convert pointers to their original form and then to strings
00484     // so that they can be written with XMLCode.h
00485     if (m_ValueMapTemp.get_ptrType() == ValueMap::m_double){
00486       valToWrite = stringConverter(*(double*)m_ValueMapTemp.get_ptr());
00487     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_int){
00488       valToWrite = stringConverter(*(int*)m_ValueMapTemp.get_ptr());
00489     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_long){
00490       valToWrite = stringConverter(*(long*)m_ValueMapTemp.get_ptr());
00491     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_bool){
00492       valToWrite = stringConverter(*(bool*)m_ValueMapTemp.get_ptr());
00493     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_string){
00494       valToWrite = *(std::string*)m_ValueMapTemp.get_ptr();
00495     }
00496 
00497 
00498     *MyFile << xml.data(valToWrite);
00499     msg << MSG::DEBUG << "XML written: " << m_ValNamesMapIt->first << " , "
00500         << valToWrite << endmsg;
00501 
00502     *MyFile << xml.tagEnd("Value", 0);
00503     *MyFile << xml.tagEnd("Incident",2);
00504   }
00505 
00506 
00507   *MyFile << xml.tagEnd("Run",1)
00508           << xml.tagEnd("Results", 0);
00509 
00510 }
00511 
00512 
00513 // Write the map to a standard text logfile
00514 void DataListenerSvc::writeMap (ValNamesMap* m_ValNamesMap,
00515                    const Incident& Inc, std::ofstream* MyFile)
00516 {
00517   // prepare time ctime.h and remove trailing carriage return
00518   time ( &rawTime2 );
00519   sprintf (buffer2, "%s", ctime(&rawTime2));
00520   timeDate2 = buffer2;
00521   timeDate2.erase(timeDate2.size()-1, 1);
00522 
00523   // headings for the text file with spacing numbers
00524   std::string space = "   ";
00525   std::string heading0 = "Time                       "; // 27
00526   std::string heading1 = "No      "; // 8 chars long
00527   std::string heading2 = "Incident Type     "; // 18
00528   std::string heading3 = "Incident Source   "; // 18
00529   std::string heading4 = "Name            ";  // 16
00530   std::string heading5 = "Value               "; // 20
00531 
00532   *MyFile << heading0 + heading1 + heading2 + heading3 + heading4 + heading5
00533           << std::endl;
00534 
00535   for (m_ValNamesMapIt = m_ValNamesMap->begin();
00536        m_ValNamesMapIt != m_ValNamesMap->end();
00537        ++m_ValNamesMapIt){
00538 
00539     m_ValueMapTemp = m_ValNamesMapIt->second;
00540 
00541     *MyFile << timeDate2 << space
00542 
00543             << resizeString(stringConverter(numIncidents),8) // Counts # incidents
00544             << resizeString(Inc.type(),18)                 // Incident Type
00545             << resizeString(Inc.source(),18)               // Source of the Incident
00546             << resizeString(m_ValNamesMapIt->first,20);    // Variable Name
00547 
00548     // Check the variable type and in each case, cast accordingly
00549     if (m_ValueMapTemp.get_ptrType() == ValueMap::m_double){
00550       *MyFile << resizeString(stringConverter(*(double*)m_ValueMapTemp.get_ptr()), 12)
00551               << std::endl;
00552     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_int){
00553       *MyFile << resizeString(stringConverter(*(int*)m_ValueMapTemp.get_ptr()), 12)
00554               << std::endl;
00555     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_long){
00556       *MyFile << resizeString(stringConverter(*(long*)m_ValueMapTemp.get_ptr()), 12)
00557               << std::endl;
00558     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_bool){
00559       *MyFile << resizeString(stringConverter(*(bool*)m_ValueMapTemp.get_ptr()), 12)
00560               << std::endl;
00561     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_string){
00562       *MyFile << resizeString((*(std::string*)m_ValueMapTemp.get_ptr()), 12)
00563               << std::endl;
00564       }
00565 
00566       }
00567 
00568 }
00569 
00570 
00571 void DataListenerSvc::sendData(ValNamesMap* m_ValNamesMap)
00572 {
00573 
00574   for (m_ValNamesMapIt = m_ValNamesMap->begin();
00575        m_ValNamesMapIt != m_ValNamesMap->end();
00576        ++m_ValNamesMapIt){
00577 
00578     m_ValueMapTemp = m_ValNamesMapIt->second;
00579     keyToSend = const_cast<char*>((m_ValNamesMapIt->first).c_str());
00580 
00581 
00582     if (m_ValueMapTemp.get_ptrType() == ValueMap::m_double){
00583       apmSend(const_cast <char*>(m_MLClusterName.c_str()),
00584               const_cast <char*> (jobIDString.c_str()),
00585               keyToSend, *(double*)m_ValueMapTemp.get_ptr());
00586     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_int){
00587       apmSend(const_cast <char*>(m_MLClusterName.c_str()),
00588               const_cast <char*> (jobIDString.c_str()),
00589               keyToSend, *(int*)m_ValueMapTemp.get_ptr());
00590     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_long){
00591       apmSend(const_cast <char*>(m_MLClusterName.c_str()),
00592               const_cast <char*> (jobIDString.c_str()),
00593               keyToSend, *(long*)m_ValueMapTemp.get_ptr());
00594     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_bool){
00595       apmSend(const_cast <char*>(m_MLClusterName.c_str()),
00596               const_cast <char*> (jobIDString.c_str()),
00597               keyToSend, *(bool*)m_ValueMapTemp.get_ptr());
00598     } else if (m_ValueMapTemp.get_ptrType() == ValueMap::m_string){
00599       apmSend(const_cast <char*>(m_MLClusterName.c_str()),
00600               const_cast <char*> (jobIDString.c_str()),
00601               keyToSend, const_cast <char*>((*(std::string*)m_ValueMapTemp.get_ptr()).c_str()));
00602     }
00603   }
00604 
00605 }
00606 
00607 
00608 void DataListenerSvc::apmSend(char* clusterName, char* clusterNode,
00609                               char* key, double val)
00610 {
00611   MsgStream msg(msgSvc(),"DataListenerSvc");
00612   msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00613 
00614   try {
00615     DataListenerSvc::apm->sendParameter( clusterName, clusterNode, key, val);
00616     msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00617     msg << MSG::INFO << "Sent parameters to MonALISA sever:"
00618         << m_MLClusterName << "->"
00619         << jobIDString.c_str() << "->"
00620         << key << ":" << val << endmsg;
00621   } catch(std::runtime_error &e) {
00622     msg << MSG::WARNING << "WARNING sending to ApMon:\t" << e.what() << endmsg;
00623   }
00624 }
00625 
00626 void DataListenerSvc::apmSend(char* clusterName, char* clusterNode,
00627                               char* key, int val)
00628 {
00629   MsgStream msg(msgSvc(),"DataListenerSvc");
00630   msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00631   try {
00632     DataListenerSvc::apm->sendParameter( clusterName, clusterNode, key, val);
00633     msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00634     msg << MSG::INFO << "Sent parameters to MonALISA sever:"
00635         << m_MLClusterName << "->"
00636         << jobIDString.c_str() << "->"
00637         << key << ":" << val << endmsg;
00638   } catch(std::runtime_error &e) {
00639     msg << MSG::WARNING << "WARNING sending to ApMon:\t" << e.what() << endmsg;
00640   }
00641 }
00642 
00643 void DataListenerSvc::apmSend(char* clusterName, char* clusterNode,
00644                               char* key, long val)
00645 {
00646   MsgStream msg(msgSvc(),"DataListenerSvc");
00647   msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00648   double temp;
00649   temp = *(double*)val;
00650 
00651   try {
00652     DataListenerSvc::apm->sendParameter( clusterName, clusterNode, key, temp);
00653     msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00654     msg << MSG::INFO << "Sent parameters to MonALISA sever:"
00655         << m_MLClusterName << "->"
00656         << jobIDString.c_str() << "->"
00657         << key << ":" << val << endmsg;
00658   } catch (std::runtime_error &e){
00659     msg << MSG::WARNING << "WARNING sending to ApMon:\t" << e.what() << endmsg;
00660   }
00661 }
00662 
00663 void DataListenerSvc::apmSend(char* clusterName, char* clusterNode,
00664                               char* key, bool val)
00665 {
00666   MsgStream msg(msgSvc(),"DataListenerSvc");
00667   msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00668   try {
00669     DataListenerSvc::apm->sendParameter( clusterName, clusterNode, key, val);
00670     msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00671     msg << MSG::INFO << "Sent parameters to MonALISA sever:"
00672         << m_MLClusterName << "->"
00673         << jobIDString.c_str() << "->"
00674         << key << ":" << val << endmsg;
00675   } catch (std::runtime_error &e){
00676     msg << MSG::WARNING << "WARNING sending to ApMon:\t" << e.what() << endmsg;
00677   }
00678 }
00679 
00680 void DataListenerSvc::apmSend(char* clusterName, char* clusterNode,
00681                               char* key, char* val)
00682 {
00683   MsgStream msg(msgSvc(),"DataListenerSvc");
00684   msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00685   try {
00686     DataListenerSvc::apm->sendParameter( clusterName, clusterNode, key, val);
00687     msg << MSG::DEBUG << "ApMon instantiated" << endmsg;
00688     msg << MSG::INFO << "Sent parameters to MonALISA sever:"
00689         << m_MLClusterName << "->"
00690         << jobIDString.c_str() << "->"
00691         << key << ":" << val << endmsg;
00692   } catch (std::runtime_error &e){
00693     msg << MSG::WARNING << "WARNING sending to ApMon:\t" << e.what() << endmsg;
00694   }
00695 }

Generated at Thu Sep 30 09:57:35 2010 for Gaudi Framework, version v21r11 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004