BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
JobInfoSvc Class Reference

#include <JobInfoSvc.h>

Inheritance diagram for JobInfoSvc:

Public Member Functions

 JobInfoSvc (const std::string &name, ISvcLocator *pSvcLocator)
 ~JobInfoSvc ()
StatusCode initialize ()
StatusCode finalize ()
void handle (const Incident &)
int xmlrpc (int evtNum)
std::string getJobOutputFile ()

Detailed Description

Definition at line 12 of file JobInfoSvc.h.

Constructor & Destructor Documentation

◆ JobInfoSvc()

JobInfoSvc::JobInfoSvc ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 23 of file JobInfoSvc.cxx.

24 : base_class( name, pSvcLocator ) {
25 declareProperty( "xmlrpcServer", m_xmlrpcServer = "202.122.37.68" );
26 declareProperty( "xmlrpcPort", m_xmlrpcPort = 8080 );
27 declareProperty( "xmlrpcUrl", m_xmlrpcUrl = "/bemp/xmlrpc" );
28 declareProperty( "xmlrpcMethod", m_xmlrpcMethod = "SetJobInfo.setEvtNum" );
29}

Referenced by JobInfoSvc().

◆ ~JobInfoSvc()

JobInfoSvc::~JobInfoSvc ( )
inline

Definition at line 16 of file JobInfoSvc.h.

16{};

Member Function Documentation

◆ finalize()

StatusCode JobInfoSvc::finalize ( )

Definition at line 75 of file JobInfoSvc.cxx.

75 {
76 MsgStream log( msgSvc(), name() );
77 log << MSG::INFO << "in finalize" << endmsg;
78
79 // Keep this line for log file output please!
80 std::cout << "JobInfoSvc: totle event number = " << m_count << std::endl;
81
82 // Save event number to job manage database
83 xmlrpc( m_count );
84
85 return StatusCode::SUCCESS;
86}
IMessageSvc * msgSvc()
int xmlrpc(int evtNum)

◆ getJobOutputFile()

std::string JobInfoSvc::getJobOutputFile ( )

Definition at line 108 of file JobInfoSvc.cxx.

108 {
109 MsgStream log( msgSvc(), name() );
110 std::string outputFileName = "";
111
112 // IJobOptionsSvc *jobSvc;
113 // Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
114 // const std::vector<const Property *> *properties_event =
115 // jobSvc->getProperties("EventCnvSvc"); if (properties_event != NULL)
116 // {
117 // for (unsigned int i = 0; i < properties_event->size(); i++)
118 // {
119 // if ((*properties_event)[i]->name() == "digiRootOutputFile")
120 // {
121 // outputFileName = (*properties_event)[i]->toString();
122 // break;
123 // }
124 // }
125 // }
126
127 auto evtCnvSvcProp = serviceLocator()->service<IProperty>( "EventCnvSvc" );
128 auto properties_event = evtCnvSvcProp->getProperties();
129 for ( auto prop : properties_event )
130 if ( prop->name() == "digiRootOutputFile" )
131 {
132 outputFileName = prop->toString();
133 break;
134 }
135
136 // const std::vector<const Property *> *properties_root =
137 // jobSvc->getProperties("RootCnvSvc"); if (properties_root != NULL)
138 // {
139 // for (unsigned int i = 0; i < properties_root->size(); i++)
140 // {
141 // if ((*properties_root)[i]->name() == "digiRootOutputFile")
142 // {
143 // outputFileName = (*properties_root)[i]->toString();
144 // break;
145 // }
146 // }
147 // }
148
149 auto rootCnvSvcProp = serviceLocator()->service<IProperty>( "RootCnvSvc" );
150 auto properties_root = rootCnvSvcProp->getProperties();
151 for ( auto prop : properties_root )
152 if ( prop->name() == "digiRootOutputFile" )
153 {
154 outputFileName = prop->toString();
155 break;
156 }
157
158 // FIXME for RawDataCnvSvc
159
160 return outputFileName;
161}

Referenced by initialize().

◆ handle()

void JobInfoSvc::handle ( const Incident & inc)

Definition at line 63 of file JobInfoSvc.cxx.

63 {
64 MsgStream log( msgSvc(), name() );
65
66 log << MSG::DEBUG << "handle: " << inc.type() << endmsg;
67 if ( inc.type() == "BeginEvent" )
68 {
69 log << MSG::DEBUG << "Begin Event" << endmsg;
70 // count execute time
71 m_count++;
72 }
73}

◆ initialize()

StatusCode JobInfoSvc::initialize ( )

Definition at line 31 of file JobInfoSvc.cxx.

31 {
32 MsgStream log( msgSvc(), name() );
33 log << MSG::INFO << "in initialize" << endmsg;
34
35 StatusCode sc = Service::initialize();
36 if ( sc.isFailure() ) return sc;
37
38 IIncidentSvc* incsvc;
39 sc = service( "IncidentSvc", incsvc );
40 int priority = 100;
41 if ( sc.isSuccess() ) { incsvc->addListener( this, "BeginEvent", priority ); }
42
43 m_outputFileName = getJobOutputFile();
44 m_count = 0;
45
46 // Set initialize value of real event number
47 xmlrpc( -1 );
48
49 return StatusCode::SUCCESS;
50}
std::string getJobOutputFile()

◆ xmlrpc()

int JobInfoSvc::xmlrpc ( int evtNum)

Definition at line 88 of file JobInfoSvc.cxx.

88 {
89 MsgStream log( msgSvc(), name() );
90
91 XmlRpcClient c( m_xmlrpcServer.c_str(), m_xmlrpcPort, m_xmlrpcUrl.c_str() );
92 XmlRpcValue args, result;
93
94 args[0] = m_outputFileName;
95 args[1] = evtNum;
96
97 if ( args[0] != "" && c.execute( m_xmlrpcMethod.c_str(), args, result ) )
98 { log << MSG::INFO << " set evtNum = " << evtNum << endmsg; }
99 else
100 {
101 log << MSG::ERROR << " Error in execute " << m_xmlrpcMethod << endmsg;
102 return -1;
103 }
104
105 return 0;
106}

Referenced by finalize(), and initialize().


The documentation for this class was generated from the following files: