CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
DistBossServer Class Reference

#include <DistBossServer.h>

Public Member Functions

 DistBossServer (const std::string &jobOpt)
 
 ~DistBossServer ()
 
const std::string & serverName () const
 
int run ()
 

Detailed Description

Definition at line 9 of file DistBossServer.h.

Constructor & Destructor Documentation

◆ DistBossServer()

DistBossServer::DistBossServer ( const std::string & jobOpt)

Definition at line 37 of file DistBossServer.cxx.

38 : m_optMgr(jobOpt)
39{
40 if ( m_optMgr.evtMax() == 0 ) {
41 std::cout << "[DistBossServer] EvtMax = 0, exit now!" << std::endl;
42 exit(0);
43 }
44
45 std::cout << "[DistBossServer] Starting server: " << m_serverName << std::endl;
46
47 switch ( m_optMgr.inputType() ) {
48 case ( 0 ) :
49 m_readerRpc = new ReaderRpc<RawFileReader>(m_svc[0], m_optMgr.inputFiles(), m_optMgr.evtMax());
50 break;
51 case ( 1 ) :
52 std::cout << "[DistBossServer] Simulation is not supported by DistBoss yet!" << std::endl;
53 exit(1);
54 case ( 2 ) :
55 //m_readerRpc = new ReaderRpc<RootFileReader>(m_svc[2], m_optMgr.inputFiles(), m_optMgr.evtMax());
56 //break;
57 std::cout << "[DistBossServer] Root input files are not supported by DistBoss yet!" << std::endl;
58 exit(1);
59 default :
60 assert( false ); //we shouldn't come here
61 }
62
63 const std::vector<int>& outputs = m_optMgr.outputTypes();
64 for ( std::vector<int>::const_iterator it = outputs.begin(); it != outputs.end(); ++it ) {
65 switch ( *it ) {
66 case ( 3 ) :
67 m_writerRpcs.push_back(new WriterRpc<RootFileWriter>(m_svc[3], m_optMgr.dstFile()));
68 break;
69 case ( 4 ) :
70 m_writerRpcs.push_back(new WriterRpc<RootFileWriter>(m_svc[4], m_optMgr.recFile()));
71 break;
72 case ( 5 ) :
73 //std::cout << "[DistBossServer] Ntuple outputs is not supported by DistBoss yet!" << std::endl;
74 break;
75 case ( 6 ) :
76 //std::cout << "[DistBossServer] Hist outputs is not supported by DistBoss yet!" << std::endl;
77 break;
78 default :
79 assert(false); //we shouldn't come here
80 }
81 }
82
83 m_optMgr.clientOptsTemplate( m_serverName );
84
85 m_exitHandler = new ServerExitHandler();
86 m_errorHandler = new ServerErrorHandler();
87}
const std::string & dstFile()
const std::vector< std::string > & inputFiles()
void clientOptsTemplate(const std::string &svrName)
const std::vector< int > & outputTypes()
const std::string & recFile()

Referenced by DistBossServer().

◆ ~DistBossServer()

DistBossServer::~DistBossServer ( )

Definition at line 89 of file DistBossServer.cxx.

90{
91 delete m_readerRpc;
92
93 for ( unsigned int i = 0; i < m_writerRpcs.size(); ++i ) {
94 delete m_writerRpcs[i];
95 }
96
97 std::cout << "[DistBossServer] Server stopped." << std::endl;
98
99 delete m_exitHandler;
100}

Member Function Documentation

◆ run()

int DistBossServer::run ( )

Definition at line 102 of file DistBossServer.cxx.

103{
104 DimServer::addExitHandler( m_exitHandler );
105 DimServer::addErrorHandler( m_errorHandler );
106
107 DimServer::start(m_serverName.c_str());
108
109 // we'd better check the return value of wait_to_end() here
110 int nClients = m_readerRpc->wait_to_end();
111
112 for ( unsigned int i = 0; i < m_writerRpcs.size(); ++i ) {
113 nClients = m_writerRpcs[i]->wait_to_end();
114 }
115
116 return nClients;
117}
virtual int wait_to_end()=0

Referenced by main().

◆ serverName()

const std::string & DistBossServer::serverName ( ) const
inline

Definition at line 16 of file DistBossServer.h.

16{ return m_serverName; }

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