BOSS 7.1.1
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 28 of file JobInfoSvc.cxx.

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

◆ ~JobInfoSvc()

JobInfoSvc::~JobInfoSvc ( )
inline

Definition at line 18 of file JobInfoSvc.h.

18{};

Member Function Documentation

◆ finalize()

StatusCode JobInfoSvc::finalize ( )

Definition at line 82 of file JobInfoSvc.cxx.

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

◆ getJobOutputFile()

std::string JobInfoSvc::getJobOutputFile ( )

Definition at line 114 of file JobInfoSvc.cxx.

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

Referenced by initialize().

◆ handle()

void JobInfoSvc::handle ( const Incident & inc)

Definition at line 70 of file JobInfoSvc.cxx.

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

◆ initialize()

StatusCode JobInfoSvc::initialize ( )

Definition at line 36 of file JobInfoSvc.cxx.

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

◆ xmlrpc()

int JobInfoSvc::xmlrpc ( int evtNum)

Definition at line 95 of file JobInfoSvc.cxx.

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