#include <JobInfoWriterAlg.h>
Inheritance diagram for JobInfoWriterAlg:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
Public Member Functions | |
JobInfoWriterAlg (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~JobInfoWriterAlg () |
virtual StatusCode | initialize () |
virtual StatusCode | execute () |
virtual StatusCode | finalize () |
virtual StatusCode | endRun () |
virtual void | handle (const Incident &incident) |
virtual StatusCode | sysExecute () |
void | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
void | put (DataObject *object, const std::string &address, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (const std::string &location, const bool useRootInTES=true) const |
TYPE * | getDet (IDataProviderSvc *svc, const std::string &location) const |
TYPE * | getDet (const std::string &location) const |
bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
bool | exist (const std::string &location, const bool useRootInTES=true) const |
bool | existDet (IDataProviderSvc *svc, const std::string &location) const |
bool | existDet (const std::string &location) const |
TYPE * | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
TYPE * | getOrCreate (const std::string &location, const bool useRootInTES=true) const |
bool | registerContext () const |
INTupleSvc * | evtColSvc () const |
IAlgContextSvc * | contextSvc () const |
TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
SERVICE * | svc (const std::string &name, const bool create=true) const |
IUpdateManagerSvc * | updMgrSvc () const |
IDataProviderSvc * | fastContainersSvc () const |
StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
StatusCode | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
MsgStream & | msgStream (const MSG::Level level) const |
MsgStream & | always () const |
MsgStream & | fatal () const |
MsgStream & | err () const |
MsgStream & | error () const |
MsgStream & | warning () const |
MsgStream & | info () const |
MsgStream & | debug () const |
MsgStream & | verbose () const |
MsgStream & | msg () const |
const Statistics & | counters () const |
StatEntity & | counter (const std::string &tag) const |
MSG::Level | msgLevel () const |
bool | msgLevel (const MSG::Level level) const |
void | resetMsgStream () const |
bool | typePrint () const |
bool | propsPrint () const |
bool | statPrint () const |
bool | errorsPrint () const |
long | printStat (const MSG::Level level=MSG::ALWAYS) const |
long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
long | printProps (const MSG::Level level=MSG::ALWAYS) const |
void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
StatusCode | runUpdate () |
TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
StatusCode | release (const IInterface *interface) const |
unsigned long | release () |
const std::string & | context () const |
const std::string & | rootInTES () const |
double | globalTimeOffset () const |
virtual StatusCode | sysStart () |
virtual StatusCode | sysInitialize () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysFinalize () |
virtual StatusCode | sysBeginRun () |
virtual StatusCode | sysEndRun () |
virtual const std::string & | name () const |
virtual const std::string & | version () const |
virtual StatusCode | configure () |
virtual StatusCode | terminate () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual bool | isExecuted () const |
virtual void | setExecuted (bool state) |
virtual void | resetExecuted () |
virtual StatusCode | beginRun () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual bool | isEnabled () const |
virtual bool | filterPassed () const |
virtual void | setFilterPassed (bool state) |
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const |
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const |
void | setOutputLevel (int level) |
IAuditorSvc * | auditorSvc () const |
IChronoStatSvc * | chronoSvc () const |
IChronoStatSvc * | chronoStatService () const |
IDataProviderSvc * | detSvc () const |
IDataProviderSvc * | detDataService () const |
IConversionSvc * | detCnvSvc () const |
IConversionSvc * | detDataCnvService () const |
IDataProviderSvc * | eventSvc () const |
IDataProviderSvc * | evtSvc () const |
IDataProviderSvc * | eventDataService () const |
IConversionSvc * | eventCnvSvc () const |
IConversionSvc * | eventDataCnvService () const |
IHistogramSvc * | histoSvc () const |
IHistogramSvc * | histogramDataService () const |
IMessageSvc * | msgSvc () const |
IMessageSvc * | messageService () const |
INTupleSvc * | ntupleSvc () const |
INTupleSvc * | ntupleService () const |
IRndmGenSvc * | randSvc () const |
IToolSvc * | toolSvc () const |
IExceptionSvc * | exceptionSvc () const |
ISvcLocator * | serviceLocator () const |
ISvcLocator * | svcLoc () const |
StatusCode | createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg) |
std::vector< Algorithm * > * | subAlgorithms () const |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
virtual const std::vector< Property * > & | getProperties () const |
StatusCode | setProperties () |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
IMonitorSvc * | monitorSvc () const |
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
unsigned long | addRef () |
StatusCode | queryInterface (const InterfaceID &riid, void **) |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)=0 |
virtual unsigned long | addRef ()=0 |
virtual unsigned long | release ()=0 |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Types | |
typedef std::map< std::string, StatEntity > | Statistics |
typedef std::map< std::string, unsigned int > | Counter |
typedef std::vector< IAlgTool * > | AlgTools |
typedef std::pair< IInterface *, std::string > | ServiceEntry |
typedef std::vector< ServiceEntry > | Services |
Protected Member Functions | |
StatusCode | releaseTool (const IAlgTool *tool) const |
StatusCode | releaseSvc (const IInterface *svc) const |
bool | isInitialized () const |
bool | isFinalized () const |
int | outputLevel () const |
IntegerProperty & | outputLevelProperty () |
void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
static const bool | IgnoreRootInTES |
static const bool | UseRootInTES |
Private Member Functions | |
StatusCode | writeDataToFile () |
StatusCode | writeDataToDatabase () |
Private Attributes | |
bool | m_writeToFile |
bool | m_writeToDatabase |
std::string | m_jobInfoLocation |
IDybStorageSvc * | m_storageSvc |
IJobInfoSvc * | m_jobInfoSvc |
IIncidentSvc * | m_incsvc |
Definition at line 22 of file JobInfoWriterAlg.h.
JobInfoWriterAlg::JobInfoWriterAlg | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 12 of file JobInfoWriterAlg.cc.
00014 : GaudiAlgorithm(name,pSvcLocator), 00015 m_storageSvc(0), 00016 m_jobInfoSvc(0) 00017 { 00018 declareProperty("JobInfoLocation", 00019 m_jobInfoLocation=DayaBay::JobHeaderLocation::Default, 00020 "Location in file where job info is to be found."); 00021 declareProperty("WriteToFile",m_writeToFile=false, 00022 "Write the job info to the current output file?"); 00023 declareProperty("WriteToDatabase",m_writeToDatabase=false, 00024 "Write the job info to the offline database?"); 00025 }
JobInfoWriterAlg::~JobInfoWriterAlg | ( | ) | [virtual] |
StatusCode JobInfoWriterAlg::initialize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 31 of file JobInfoWriterAlg.cc.
00032 { 00033 // Initialize the necessary services 00034 if( m_writeToFile ){ 00035 StatusCode sc = this->service("DybStorageSvc",m_storageSvc,true); 00036 if(sc.isFailure()){ 00037 error() << "Failed to get DybStorageSvc" << endreq; 00038 return sc; 00039 } 00040 } 00041 StatusCode sc = this->service("JobInfoSvc",m_jobInfoSvc,true); 00042 if(sc.isFailure()){ 00043 error() << "Failed to get JobInfoSvc" << endreq; 00044 return sc; 00045 } 00046 00047 // Get and hold on to the incident service and add ourself. 00048 sc = this->service("IncidentSvc",m_incsvc,true); 00049 if (sc.isFailure()) { 00050 error() << "Failed to get IncidentSvc" << endreq; 00051 return sc; 00052 } 00053 m_incsvc->addListener(this,"RootIOIncident"); 00054 00055 return StatusCode::SUCCESS; 00056 }
StatusCode JobInfoWriterAlg::execute | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 58 of file JobInfoWriterAlg.cc.
00059 { 00060 return StatusCode::SUCCESS; 00061 }
StatusCode JobInfoWriterAlg::finalize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 63 of file JobInfoWriterAlg.cc.
00064 { 00065 m_jobInfoSvc->release(); 00066 00067 // Must remove self. O.w. we may finalize before RootIOSvc and 00068 // leave beind a dangling handler. 00069 m_incsvc->removeListener(this,"RootIOIncident"); 00070 m_incsvc->release(); 00071 00072 return StatusCode::SUCCESS; 00073 }
StatusCode JobInfoWriterAlg::endRun | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 76 of file JobInfoWriterAlg.cc.
00077 { 00078 // Write the job info to file/database at the end of the run 00079 StatusCode sc = StatusCode::SUCCESS; 00080 if( m_writeToFile ) sc = this->writeDataToFile(); 00081 if( !sc.isSuccess() ) return sc; 00082 if( m_writeToDatabase ) sc = this->writeDataToDatabase(); 00083 return sc; 00084 }
void JobInfoWriterAlg::handle | ( | const Incident & | incident | ) | [virtual] |
Implements IIncidentListener.
Definition at line 125 of file JobInfoWriterAlg.cc.
00126 { 00127 if (!m_writeToFile) return; 00128 00129 // Handle the incident in a trivial manner 00130 00131 const RootIOIncident* rioinc = dynamic_cast<const RootIOIncident*>(&incident); 00132 if (!rioinc) { 00133 warning() 00134 << "Ignoring unexpected incident not of class RootIOIncident" 00135 << endreq; 00136 return; 00137 } 00138 00139 if (rioinc->state() != RootIOIncident::opened_output) { 00140 return; 00141 } 00142 00143 StatusCode sc = this->writeDataToFile(); 00144 if (sc.isFailure()) { 00145 error() 00146 << "Failed to write JobInfo to output file " 00147 << "while handling opened output incidence" 00148 << endreq; 00149 } 00150 debug() << "Handled closing_output for " << rioinc->filename() << endreq; 00151 }
StatusCode JobInfoWriterAlg::writeDataToFile | ( | ) | [private] |
Definition at line 86 of file JobInfoWriterAlg.cc.
00086 { 00087 // Write job info to current output file 00088 00089 debug() << "Writing JobInfo" << endreq; 00090 00091 std::vector<DayaBay::JobInfo*> jobInfo = m_jobInfoSvc->cachedJobInfo(); 00092 00093 // Create Job Header 00094 DayaBay::JobHeader jobHeader; 00095 jobHeader.setJobInfoList( jobInfo ); 00096 00097 // Have to put JobHeader in a registry for DybStorageSvc to work correctly 00098 DataSvcHelpers::RegistryEntry* regEntry 00099 = new DataSvcHelpers::RegistryEntry(m_jobInfoLocation); 00100 regEntry->setObject(&jobHeader); 00101 00102 debug() << "Storing JobHeader with " 00103 << jobInfo.size() << " entries at " 00104 << m_jobInfoLocation << endreq; 00105 StatusCode sc = m_storageSvc->store(&jobHeader, m_jobInfoLocation); 00106 debug() << "Stored JobHeader" << endreq; 00107 if(sc.isFailure()){ 00108 error() << "Failed to store Job Header to output file" << endreq; 00109 } 00110 00111 // Clear job info to prevent deleting 00112 jobInfo.clear(); 00113 jobHeader.setJobInfoList( jobInfo ); 00114 00115 return sc; 00116 }
StatusCode JobInfoWriterAlg::writeDataToDatabase | ( | ) | [private] |
Definition at line 118 of file JobInfoWriterAlg.cc.
00118 { 00119 // Write Job Info to offline database 00120 warning() << "Writing job info to offline database is not yet implemented." 00121 << endreq; 00122 return StatusCode::SUCCESS; 00123 }
bool JobInfoWriterAlg::m_writeToFile [private] |
Definition at line 45 of file JobInfoWriterAlg.h.
bool JobInfoWriterAlg::m_writeToDatabase [private] |
Definition at line 48 of file JobInfoWriterAlg.h.
std::string JobInfoWriterAlg::m_jobInfoLocation [private] |
Definition at line 51 of file JobInfoWriterAlg.h.
IDybStorageSvc* JobInfoWriterAlg::m_storageSvc [private] |
Definition at line 54 of file JobInfoWriterAlg.h.
IJobInfoSvc* JobInfoWriterAlg::m_jobInfoSvc [private] |
Definition at line 56 of file JobInfoWriterAlg.h.
IIncidentSvc* JobInfoWriterAlg::m_incsvc [private] |
Definition at line 58 of file JobInfoWriterAlg.h.