31 #include "RConfigure.h"
55 void TSlaveLite::DoError(
int level,
const char *location,
56 const char *fmt, va_list va)
const
58 ::ErrorHandler(level, Form(
"TSlaveLite::%s", location), fmt, va);
64 TSlaveLite::TSlaveLite(
const char *ord, Int_t perf,
65 const char *image, TProof *proof, Int_t stype,
66 const char *workdir,
const char *msd, Int_t) : TSlave()
70 fProofWorkDir = workdir;
75 fSlaveType = (ESlaveType)stype;
79 fProtocol = kPROOF_Protocol;
81 if (fPerfIdx > 0) Init();
87 void TSlaveLite::Init()
91 cmd.Form(
". %s/worker-%s.env; export ROOTBINDIR=\"%s\"; %s/proofserv proofslave lite %d %d 0&",
92 fWorkDir.Data(), fOrdinal.Data(), TROOT::GetBinDir().Data(), TROOT::GetBinDir().Data(),
93 gSystem->GetPid(), gDebug);
95 if (gSystem->Exec(cmd) != 0) {
96 Error(
"Init",
"an error occured while executing 'proofserv'");
97 SetBit(kInvalidObject);
107 Int_t TSlaveLite::SetupServ(Int_t,
const char *)
113 if (fSocket->Recv(buf,
sizeof(buf), what) <= 0) {
114 Error(
"SetupServ",
"failed to receive slave startup message");
121 if (what == kMESS_NOTOK) {
129 if (fSocket->Recv(msg) <= 0 || !msg || msg->What() != kPROOF_SESSIONTAG) {
130 Error(
"SetupServ",
"failed to receive unique session tag");
137 (*msg) >> fSessionTag;
140 fName = gSystem->HostName();
149 TSlaveLite::~TSlaveLite()
157 void TSlaveLite::Close(Option_t *opt)
170 void TSlaveLite::Print(Option_t *)
const
172 const char *sst[] = {
"invalid" ,
"valid",
"inactive" };
173 Int_t st = fSocket ? ((fStatus == kInactive) ? 2 : 1) : 0;
175 Printf(
"*** Worker %s (%s)", fOrdinal.Data(), sst[st]);
176 Printf(
" Worker session tag: %s", GetSessionTag());
177 Printf(
" ROOT version|rev|tag: %s", GetROOTVersion());
178 Printf(
" Architecture-Compiler: %s", GetArchCompiler());
180 Printf(
" Working directory: %s", GetWorkDir());
181 Printf(
" MB's processed: %.2f",
float(GetBytesRead())/(1024*1024));
182 Printf(
" MB's sent: %.2f",
float(fSocket->GetBytesRecv())/(1024*1024));
183 Printf(
" MB's received: %.2f",
float(fSocket->GetBytesSent())/(1024*1024));
184 Printf(
" Real time used (s): %.3f", GetRealTime());
185 Printf(
" CPU time used (s): %.3f", GetCpuTime());