BOSS 7.0.8
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 ()
 
StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 
void handle (const Incident &)
 
int xmlrpc (int evtNum)
 
std::string getJobOutputFile ()
 
virtual int xmlrpc (int evtNum)=0
 
virtual std::string getJobOutputFile ()=0
 

Additional Inherited Members

- Static Public Member Functions inherited from IJobInfoSvc
static const InterfaceID & interfaceID ()
 

Detailed Description

Definition at line 11 of file JobInfoSvc.h.

Constructor & Destructor Documentation

◆ JobInfoSvc()

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

Definition at line 27 of file JobInfoSvc.cxx.

27 :
28 Service(name, pSvcLocator) {
29 declareProperty("xmlrpcServer", m_xmlrpcServer = "202.122.37.68");
30 declareProperty("xmlrpcPort", m_xmlrpcPort = 8080);
31 declareProperty("xmlrpcUrl", m_xmlrpcUrl = "/bemp/xmlrpc");
32 declareProperty("xmlrpcMethod", m_xmlrpcMethod = "SetJobInfo.setEvtNum");
33 }

◆ ~JobInfoSvc()

JobInfoSvc::~JobInfoSvc ( )
inline

Definition at line 17 of file JobInfoSvc.h.

17{};

Member Function Documentation

◆ finalize()

StatusCode JobInfoSvc::finalize ( )

Definition at line 81 of file JobInfoSvc.cxx.

81 {
82 MsgStream log(msgSvc(), name());
83 log << MSG::INFO << "in finalize" << endreq;
84
85 //Keep this line for log file output please!
86 std::cout<< "JobInfoSvc: totle event number = "<< m_count << std::endl;
87
88 //Save event number to job manage database
89 xmlrpc(m_count);
90
91 return StatusCode::SUCCESS;
92}
IMessageSvc * msgSvc()
int xmlrpc(int evtNum)
Definition: JobInfoSvc.cxx:94

◆ getJobOutputFile()

std::string JobInfoSvc::getJobOutputFile ( )
virtual

Implements IJobInfoSvc.

Definition at line 113 of file JobInfoSvc.cxx.

113 {
114 MsgStream log(msgSvc(), name());
115 std::string outputFileName = "";
116
117 IJobOptionsSvc* jobSvc;
118 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
119
120 const std::vector<const Property*>* properties_event = jobSvc->getProperties("EventCnvSvc");
121 if (properties_event != NULL) {
122 for (unsigned int i = 0; i < properties_event->size(); i++) {
123 if ((*properties_event)[i]->name() == "digiRootOutputFile") {
124 outputFileName = (*properties_event)[i]->toString();
125 break;
126 }
127 }
128 }
129
130 const std::vector<const Property*>* properties_root = jobSvc->getProperties("RootCnvSvc");
131 if (properties_root != NULL) {
132 for (unsigned int i = 0; i < properties_root->size(); i++) {
133 if ((*properties_root)[i]->name() == "digiRootOutputFile") {
134 outputFileName = (*properties_root)[i]->toString();
135 break;
136 }
137 }
138 }
139
140 //FIXME for RawDataCnvSvc
141
142 return outputFileName;
143}
#define NULL

Referenced by initialize().

◆ handle()

void JobInfoSvc::handle ( const Incident &  inc)

Definition at line 69 of file JobInfoSvc.cxx.

69 {
70 MsgStream log( messageService(), name() );
71
72 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
73 if ( inc.type() == "BeginEvent" ){
74 log << MSG::DEBUG << "Begin Event" << endreq;
75 //count execute time
76 m_count++;
77 }
78}

◆ initialize()

StatusCode JobInfoSvc::initialize ( )

Definition at line 35 of file JobInfoSvc.cxx.

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

◆ queryInterface()

StatusCode JobInfoSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)

Definition at line 58 of file JobInfoSvc.cxx.

59{
60 if ( IJobInfoSvc::interfaceID().versionMatch(riid) ) {
61 *ppvInterface = (IJobInfoSvc*)this;
62 }else{
63 return Service::queryInterface(riid, ppvInterface);
64 }
65 addRef();
66 return StatusCode::SUCCESS;
67}
static const InterfaceID & interfaceID()
Definition: IJobInfoSvc.h:16

◆ xmlrpc()

int JobInfoSvc::xmlrpc ( int  evtNum)
virtual

Implements IJobInfoSvc.

Definition at line 94 of file JobInfoSvc.cxx.

94 {
95 MsgStream log(msgSvc(), name());
96
97 XmlRpcClient c(m_xmlrpcServer.c_str(), m_xmlrpcPort, m_xmlrpcUrl.c_str());
98 XmlRpcValue args, result;
99
100 args[0] = m_outputFileName;
101 args[1] = evtNum;
102
103 if (args[0] != "" && c.execute(m_xmlrpcMethod.c_str(), args, result)){
104 log << MSG::INFO << " set evtNum = "<< evtNum << endreq;
105 }else{
106 log << MSG::ERROR<< " Error in execute "<< m_xmlrpcMethod << endreq;
107 return -1;
108 }
109
110 return 0;
111}
A class to send XML RPC requests to a server and return the results.
Definition: XmlRpcClient.h:25
RPC method arguments and results are represented by Values.
Definition: XmlRpcValue.h:22

Referenced by finalize(), and initialize().


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