ROOT  6.06/09
Reference Guide
TQueryResultManager.cxx
Go to the documentation of this file.
1 // @(#)root/proof:$Id$
2 // Author: G. Ganis Mar 2008
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TQueryResultManager //
15 // //
16 // This class manages the query-result area. //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 
20 #include <errno.h>
21 #ifdef WIN32
22 # include <io.h>
23 #endif
24 
25 #include "TQueryResultManager.h"
26 
27 #include "TFile.h"
28 #include "THashList.h"
29 #include "TKey.h"
30 #include "TProofQueryResult.h"
31 #include "TObjString.h"
32 #include "TParameter.h"
33 #include "TProof.h"
34 #include "TProofServ.h"
35 #include "TRegexp.h"
36 #include "TSortedList.h"
37 #include "TSystem.h"
38 #include "TVirtualProofPlayer.h"
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// Constructor
42 
43 TQueryResultManager::TQueryResultManager(const char *qdir, const char *stag,
44  const char *sdir,
45  TProofLockPath *lck, FILE *logfile)
46 {
47  fQueryDir = qdir;
48  fSessionTag = stag;
49  fSessionDir = sdir;
50  fSeqNum = 0;
51  fDrawQueries = 0;
52  fKeptQueries = 0;
53  fQueries = new TList;
54  fPreviousQueries = 0;
55  fLock = lck;
56  fLogFile = (logfile) ? logfile : stdout;
57 }
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// Cleanup. Not really necessary since after this dtor there is no
61 /// live anyway.
62 
64 {
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Add part of log file concerning TQueryResult pq to its macro
71 /// container.
72 
74 {
75  if (!pq)
76  return;
77 
78  // Make sure everything is written to file
79  fflush(fLogFile);
80 
81  // Save current position
82  off_t lnow = 0;
83  if ((lnow = lseek(fileno(fLogFile), (off_t) 0, SEEK_CUR)) < 0) {
84  Error("AddLogFile", "problems lseeking current position on log file (errno: %d)", errno);
85  return;
86  }
87 
88  // The range we are interested in
89  Int_t start = pq->fStartLog;
90  if (start > -1)
91  lseek(fileno(fLogFile), (off_t) start, SEEK_SET);
92 
93  // Read the lines and add then to the internal container
94  const Int_t kMAXBUF = 4096;
95  char line[kMAXBUF];
96  while (fgets(line, sizeof(line), fLogFile)) {
97  if (line[strlen(line)-1] == '\n')
98  line[strlen(line)-1] = 0;
99  pq->AddLogLine((const char *)line);
100  }
101 
102  // Restore initial position if partial send
103  if (lnow >= 0) lseek(fileno(fLogFile), lnow, SEEK_SET);
104 }
105 ////////////////////////////////////////////////////////////////////////////////
106 /// Remove all queries results referring to previous sessions
107 
109 {
110  Int_t nd = 0;
111 
112  // Cleanup previous stuff
113  if (fPreviousQueries) {
116  }
117 
118  // Loop over session dirs
119  TString queriesdir = fQueryDir;
120  queriesdir = queriesdir.Remove(queriesdir.Index(kPROOF_QueryDir) +
121  strlen(kPROOF_QueryDir));
122  void *dirs = gSystem->OpenDirectory(queriesdir);
123  if (dirs) {
124  char *sess = 0;
125  while ((sess = (char *) gSystem->GetDirEntry(dirs))) {
126 
127  // We are interested only in "session-..." subdirs
128  if (strlen(sess) < 7 || strncmp(sess,"session",7))
129  continue;
130 
131  // We do not want this session at this level
132  if (strstr(sess, fSessionTag))
133  continue;
134 
135  // Remove the directory
136  TString qdir;
137  qdir.Form("%s/%s", queriesdir.Data(), sess);
138  PDB(kGlobal, 1)
139  Info("RemoveQuery", "removing directory: %s", qdir.Data());
140  gSystem->Exec(Form("%s %s", kRM, qdir.Data()));
141  nd++;
142  }
143  // Close directory
144  gSystem->FreeDirectory(dirs);
145  } else {
146  Warning("RemoveQuery", "cannot open queries directory: %s", queriesdir.Data());
147  }
148 
149  // Done
150  return nd;
151 }
152 
153 ////////////////////////////////////////////////////////////////////////////////
154 /// Scan the queries directory for the results of previous queries.
155 /// The headers of the query results found are loaded in fPreviousQueries.
156 /// The full query result can be retrieved via TProof::Retrieve.
157 
159 {
160  // Cleanup previous stuff
161  if (fPreviousQueries) {
164  }
165 
166  // Loop over session dirs
167  void *dirs = gSystem->OpenDirectory(dir);
168  char *sess = 0;
169  while ((sess = (char *) gSystem->GetDirEntry(dirs))) {
170 
171  // We are interested only in "session-..." subdirs
172  if (strlen(sess) < 7 || strncmp(sess,"session",7))
173  continue;
174 
175  // We do not want this session at this level
176  if (strstr(sess, fSessionTag))
177  continue;
178 
179  // Loop over query dirs
180  void *dirq = gSystem->OpenDirectory(Form("%s/%s", dir, sess));
181  char *qry = 0;
182  while ((qry = (char *) gSystem->GetDirEntry(dirq))) {
183 
184  // We are interested only in "n/" subdirs
185  if (qry[0] == '.')
186  continue;
187 
188  // File with the query result
189  TString fn = Form("%s/%s/%s/query-result.root", dir, sess, qry);
190  TFile *f = TFile::Open(fn);
191  if (f) {
192  f->ReadKeys();
193  TIter nxk(f->GetListOfKeys());
194  TKey *k = 0;
195  TProofQueryResult *pqr = 0;
196  while ((k = (TKey *)nxk())) {
197  if (!strcmp(k->GetClassName(), "TProofQueryResult")) {
198  pqr = (TProofQueryResult *) f->Get(k->GetName());
199  if (pqr) {
200  TQueryResult *qr = pqr->CloneInfo();
201  if (qr) {
202  if (!fPreviousQueries)
203  fPreviousQueries = new TList;
204  if (qr->GetStatus() > TQueryResult::kRunning) {
205  fPreviousQueries->Add(qr);
206  } else {
207  // (For the time being) remove a non completed
208  // query if not owned by anybody
209  TProofLockPath *lck = 0;
210  if (LockSession(qr->GetTitle(), &lck) == 0) {
211  RemoveQuery(qr);
212  // Unlock and remove the lock file
213  SafeDelete(lck);
214  }
215  }
216  } else {
217  Warning("ScanPreviousQueries", "unable to clone TProofQueryResult '%s:%s'",
218  pqr->GetName(), pqr->GetTitle());
219  }
220  }
221  }
222  }
223  f->Close();
224  delete f;
225  }
226  }
227  gSystem->FreeDirectory(dirq);
228  }
229  gSystem->FreeDirectory(dirs);
230 }
231 
232 ////////////////////////////////////////////////////////////////////////////////
233 /// Scan the queries directory and remove the oldest ones (and relative dirs,
234 /// if empty) in such a way only 'mxq' queries are kept.
235 /// Return 0 on success, -1 in case of problems
236 
238 {
239  // Nothing to do if mxq is -1.
240  if (mxq < 0)
241  return 0;
242 
243  // We will sort the entries using the creation time
244  TSortedList *sl = new TSortedList;
245  sl->SetOwner();
246  // List with information
247  THashList *hl = new THashList;
248  hl->SetOwner();
249 
250  // Keep track of the queries per session dir
251  TList *dl = new TList;
252  dl->SetOwner();
253 
254  // Loop over session dirs
255  TString dir = fQueryDir;
256  Int_t idx = dir.Index("session-");
257  if (idx != kNPOS)
258  dir.Remove(idx);
259  void *dirs = gSystem->OpenDirectory(dir);
260  char *sess = 0;
261  while ((sess = (char *) gSystem->GetDirEntry(dirs))) {
262 
263  // We are interested only in "session-..." subdirs
264  if (strlen(sess) < 7 || strncmp(sess,"session",7))
265  continue;
266 
267  // We do not want this session at this level
268  if (strstr(sess, fSessionTag))
269  continue;
270 
271  // Loop over query dirs
272  Int_t nq = 0;
273  void *dirq = gSystem->OpenDirectory(Form("%s/%s", dir.Data(), sess));
274  char *qry = 0;
275  while ((qry = (char *) gSystem->GetDirEntry(dirq))) {
276 
277  // We are interested only in "n/" subdirs
278  if (qry[0] == '.')
279  continue;
280 
281  // File with the query result
282  TString fn = Form("%s/%s/%s/query-result.root", dir.Data(), sess, qry);
283 
284  FileStat_t st;
285  if (gSystem->GetPathInfo(fn, st)) {
286  PDB(kGlobal, 1)
287  Info("ApplyMaxQueries","file '%s' cannot be stated: remove it", fn.Data());
288  gSystem->Unlink(gSystem->DirName(fn));
289  continue;
290  }
291 
292  // Add the entry in the sorted list
293  sl->Add(new TObjString(TString::Format("%ld", st.fMtime)));
294  hl->Add(new TNamed((const char*)TString::Format("%ld",st.fMtime), fn.Data()));
295  nq++;
296  }
297  gSystem->FreeDirectory(dirq);
298 
299  if (nq > 0)
300  dl->Add(new TParameter<Int_t>(TString::Format("%s/%s", dir.Data(), sess), nq));
301  else
302  // Remove it
303  gSystem->Exec(TString::Format("%s -fr %s/%s", kRM, dir.Data(), sess));
304  }
305  gSystem->FreeDirectory(dirs);
306 
307  // Now we apply the quota
308  TIter nxq(sl, kIterBackward);
309  Int_t nqkept = 0;
310  TObjString *os = 0;
311  while ((os = (TObjString *)nxq())) {
312  if (nqkept < mxq) {
313  // Keep this and go to the next
314  nqkept++;
315  } else {
316  // Clean this
317  TNamed *nm = dynamic_cast<TNamed *>(hl->FindObject(os->GetName()));
318  if (nm) {
319  gSystem->Unlink(nm->GetTitle());
320  // Update dir counters
321  TString tdir(gSystem->DirName(nm->GetTitle()));
322  tdir = gSystem->DirName(tdir.Data());
323  TParameter<Int_t> *nq = dynamic_cast<TParameter<Int_t>*>(dl->FindObject(tdir));
324  if (nq) {
325  Int_t val = nq->GetVal();
326  nq->SetVal(--val);
327  if (nq->GetVal() <= 0)
328  // Remove the directory if empty
329  gSystem->Exec(Form("%s -fr %s", kRM, tdir.Data()));
330  }
331  }
332  }
333  }
334 
335  // Cleanup
336  delete sl;
337  delete hl;
338  delete dl;
339 
340  // Done
341  return 0;
342 }
343 
344 ////////////////////////////////////////////////////////////////////////////////
345 /// Try locking query area of session tagged sessiontag.
346 /// The id of the locking file is returned in fid and must be
347 /// unlocked via UnlockQueryFile(fid).
348 
350 {
351  // We do not need to lock our own session
352  if (strstr(sessiontag, fSessionTag))
353  return 0;
354 
355  if (!lck) {
356  Error("LockSession","locker space undefined");
357  return -1;
358  }
359  *lck = 0;
360 
361  // Check the format
362  TString stag = sessiontag;
363  TRegexp re("session-.*-.*-.*-.*");
364  Int_t i1 = stag.Index(re);
365  if (i1 == kNPOS) {
366  Error("LockSession","bad format: %s", sessiontag);
367  return -1;
368  }
369  stag.ReplaceAll("session-","");
370 
371  // Drop query number, if any
372  Int_t i2 = stag.Index(":q");
373  if (i2 != kNPOS)
374  stag.Remove(i2);
375 
376  // Make sure that parent process does not exist anylonger
377  TString parlog = fSessionDir;
378  parlog = parlog.Remove(parlog.Index("master-")+strlen("master-"));
379  parlog += stag;
380  if (!gSystem->AccessPathName(parlog)) {
381  PDB(kGlobal, 1)
382  Info("LockSession", "parent still running: do nothing");
383  return -1;
384  }
385 
386  // Lock the query lock file
387  if (fLock) {
388  TString qlock = fLock->GetName();
389  qlock.ReplaceAll(fSessionTag, stag);
390 
391  if (!gSystem->AccessPathName(qlock)) {
392  *lck = new TProofLockPath(qlock);
393  if (((*lck)->Lock()) < 0) {
394  Error("LockSession","problems locking query lock file");
395  SafeDelete(*lck);
396  return -1;
397  }
398  }
399  }
400 
401  // We are done
402  return 0;
403 }
404 
405 ////////////////////////////////////////////////////////////////////////////////
406 /// Cleanup query dir qdir.
407 
409 {
410  if (!sessiontag) {
411  Error("CleanupSession","session tag undefined");
412  return -1;
413  }
414 
415  // Query dir
416  TString qdir = fQueryDir;
417  qdir.ReplaceAll(Form("session-%s", fSessionTag.Data()), sessiontag);
418  Int_t idx = qdir.Index(":q");
419  if (idx != kNPOS)
420  qdir.Remove(idx);
421  if (gSystem->AccessPathName(qdir)) {
422  Info("CleanupSession","query dir %s does not exist", qdir.Data());
423  return -1;
424  }
425 
426  TProofLockPath *lck = 0;
427  if (LockSession(sessiontag, &lck) == 0) {
428 
429  // Cleanup now
430  gSystem->Exec(Form("%s %s", kRM, qdir.Data()));
431 
432  // Unlock and remove the lock file
433  if (lck) {
434  gSystem->Unlink(lck->GetName());
435  SafeDelete(lck); // Unlocks, if necessary
436  }
437 
438  // We are done
439  return 0;
440  }
441 
442  // Notify failure
443  Info("CleanupSession", "could not lock session %s", sessiontag);
444  return -1;
445 }
446 
447 ////////////////////////////////////////////////////////////////////////////////
448 /// Save current status of query 'qr' to file name fout.
449 /// If fout == 0 (default) use the default name.
450 
452 {
453  if (!qr || qr->IsDraw())
454  return;
455 
456  // Create dir for specific query
457  TString querydir = Form("%s/%d",fQueryDir.Data(), qr->GetSeqNum());
458 
459  // Create dir, if needed
460  if (gSystem->AccessPathName(querydir))
461  gSystem->MakeDirectory(querydir);
462  TString ofn = fout ? fout : Form("%s/query-result.root", querydir.Data());
463 
464  // Recreate file and save query in its current status
465  TFile *f = TFile::Open(ofn, "RECREATE");
466  if (f) {
467  f->cd();
468  if (!(qr->IsArchived()))
469  qr->SetResultFile(ofn);
470  qr->Write();
471  f->Close();
472  delete f;
473  }
474 }
475 
476 ////////////////////////////////////////////////////////////////////////////////
477 /// Remove everything about query queryref; if defined 'otherlist' will containe
478 /// the list of removed pointers (already deleted)
479 
480 void TQueryResultManager::RemoveQuery(const char *queryref, TList *otherlist)
481 {
482  PDB(kGlobal, 1)
483  Info("RemoveQuery", "Enter");
484 
485  // Parse reference string
486  Int_t qry = -1;
487  TString qdir;
488  TProofQueryResult *pqr = LocateQuery(queryref, qry, qdir);
489  // Remove instance in memory
490  if (pqr) {
491  if (qry > -1) {
492  fQueries->Remove(pqr);
493  if (otherlist) otherlist->Add(pqr);
494  } else
495  fPreviousQueries->Remove(pqr);
496  delete pqr;
497  pqr = 0;
498  }
499 
500  // Remove the directory
501  PDB(kGlobal, 1)
502  Info("RemoveQuery", "removing directory: %s", qdir.Data());
503  gSystem->Exec(Form("%s %s", kRM, qdir.Data()));
504 
505  // Done
506  return;
507 }
508 
509 ////////////////////////////////////////////////////////////////////////////////
510 /// Remove everything about query qr. If soft = TRUE leave a track
511 /// in memory with the relevant info
512 
514 {
515  PDB(kGlobal, 1)
516  Info("RemoveQuery", "Enter");
517 
518  if (!qr)
519  return;
520 
521  // Remove the directory
522  TString qdir = fQueryDir;
523  qdir = qdir.Remove(qdir.Index(kPROOF_QueryDir)+strlen(kPROOF_QueryDir));
524  qdir = Form("%s/%s/%d", qdir.Data(), qr->GetTitle(), qr->GetSeqNum());
525  PDB(kGlobal, 1)
526  Info("RemoveQuery", "removing directory: %s", qdir.Data());
527  gSystem->Exec(Form("%s %s", kRM, qdir.Data()));
528 
529  // Remove from memory lists
530  if (soft) {
531  TQueryResult *qrn = qr->CloneInfo();
532  Int_t idx = fQueries->IndexOf(qr);
533  if (idx > -1)
534  fQueries->AddAt(qrn, idx);
535  else
536  SafeDelete(qrn);
537  }
538  fQueries->Remove(qr);
539  SafeDelete(qr);
540 
541  // Done
542  return;
543 }
544 
545 ////////////////////////////////////////////////////////////////////////////////
546 /// Locate query referenced by queryref. Return pointer to instance
547 /// in memory, if any, or 0. Fills qdir with the query specific directory
548 /// and qry with the query number for queries processed by this session.
549 
551 {
552  TProofQueryResult *pqr = 0;
553 
554  // Find out if the request is a for a local query or for a
555  // previously processed one
556  qry = -1;
557  if (queryref.IsDigit()) {
558  qry = queryref.Atoi();
559  } else if (queryref.Contains(fSessionTag)) {
560  Int_t i1 = queryref.Index(":q");
561  if (i1 != kNPOS) {
562  queryref.Remove(0,i1+2);
563  qry = queryref.Atoi();
564  }
565  }
566 
567  // Build dir name for specific query
568  qdir = "";
569  if (qry > -1) {
570 
571  PDB(kGlobal, 1)
572  Info("LocateQuery", "local query: %d", qry);
573 
574  // Remove query from memory list
575  if (fQueries) {
576  TIter nxq(fQueries);
577  while ((pqr = (TProofQueryResult *) nxq())) {
578  if (pqr->GetSeqNum() == qry) {
579  // Dir for specific query
580  qdir = Form("%s/%d", fQueryDir.Data(), qry);
581  break;
582  }
583  }
584  }
585 
586  } else {
587  PDB(kGlobal, 1)
588  Info("LocateQuery", "previously processed query: %s", queryref.Data());
589 
590  // Remove query from memory list
591  if (fPreviousQueries) {
592  TIter nxq(fPreviousQueries);
593  while ((pqr = (TProofQueryResult *) nxq())) {
594  if (queryref.Contains(pqr->GetTitle()) &&
595  queryref.Contains(pqr->GetName()))
596  break;
597  }
598  }
599 
600  queryref.ReplaceAll(":q","/");
601  qdir = fQueryDir;
602  qdir = qdir.Remove(qdir.Index(kPROOF_QueryDir)+strlen(kPROOF_QueryDir));
603  qdir = Form("%s/%s", qdir.Data(), queryref.Data());
604  }
605 
606  // We are done
607  return pqr;
608 }
609 
610 ////////////////////////////////////////////////////////////////////////////////
611 /// Final steps after Process() to complete the TQueryResult instance.
612 
614  TProof *proof, TVirtualProofPlayer *player)
615 {
616  if (!pq || !proof || !player) {
617  Warning("FinalizeQuery", "bad inputs: query = %p, proof = %p, player: %p ",
618  pq ? pq : 0, proof ? proof : 0, player ? player : 0);
619  return kFALSE;
620  }
621 
622  Int_t qn = pq->GetSeqNum();
623  Long64_t np = player->GetEventsProcessed();
625  TList *out = player->GetOutputList();
626 
627  Float_t cpu = proof->GetCpuTime();
628  Long64_t bytes = proof->GetBytesRead();
629 
631 
632  PDB(kGlobal, 2) Info("FinalizeQuery","query #%d", qn);
633 
634  PDB(kGlobal, 1)
635  Info("FinalizeQuery","%.1f %lld", cpu, bytes);
636 
637  // Some notification (useful in large logs)
638  Bool_t save = kTRUE;
639  switch (est) {
641  PDB(kGlobal, 1)
642  Info("FinalizeQuery", "query %d has been ABORTED <====", qn);
643  out = 0;
644  save = kFALSE;
645  break;
647  PDB(kGlobal, 1)
648  Info("FinalizeQuery",
649  "query %d has been STOPPED: %lld events processed", qn, np);
651  break;
653  PDB(kGlobal, 1)
654  Info("FinalizeQuery",
655  "query %d has been completed: %lld events processed", qn, np);
657  break;
658  default:
659  Warning("FinalizeQuery",
660  "query %d: unknown exit status (%d)", qn, player->GetExitStatus());
661  }
662 
663  // Fill some variables; in the CPU time we do not include anymore the time
664  // used on the master for preparing and merging, because we want to measure
665  // the efficiency or farction of time useful for work doen by workers
666  PDB(kGlobal, 1)
667  Info("FinalizeQuery", "cpu: %.4f, saved: %.4f, master: %.4f",
668  cpu, pq->GetUsedCPU() ,GetCpuTime());
669 // pq->SetProcessInfo(np, cpu - pq->GetUsedCPU() + GetCpuTime());
670  // We take the difference because this is the total CPU time of the session
671  pq->SetProcessInfo(np, cpu - pq->GetUsedCPU());
672  pq->RecordEnd(st, out);
673 
674  // Save the logs into the query result instance
675  AddLogFile(pq);
676 
677  // Done
678  return save;
679 }
680 
681 ////////////////////////////////////////////////////////////////////////////////
682 /// Save current query honouring the max number of queries allowed
683 
685 {
686  // We may need some cleanup
687  if (mxq > -1) {
688  if (fQueries && fKeptQueries >= mxq) {
689  // Find oldest completed and archived query
690  TQueryResult *fcom = 0;
691  TQueryResult *farc = 0;
692  TIter nxq(fQueries);
693  TQueryResult *qr = 0;
694  while (fKeptQueries >= mxq) {
695  while ((qr = (TQueryResult *) nxq())) {
696  if (qr->IsArchived()) {
697  if (qr->GetOutputList() && !farc)
698  farc = qr;
699  } else if (qr->GetStatus() > TQueryResult::kRunning && !fcom) {
700  fcom = qr;
701  }
702  if (farc && fcom)
703  break;
704  }
705  if (!farc && !fcom) {
706  break;
707  } else if (farc) {
708  RemoveQuery(farc, kTRUE);
709  fKeptQueries--;
710  farc = 0;
711  } else if (fcom) {
712  RemoveQuery(fcom);
713  fKeptQueries--;
714  fcom = 0;
715  }
716  }
717  }
718  if (fKeptQueries < mxq) {
719  SaveQuery(pq);
720  fKeptQueries++;
721  } else {
722  TString emsg;
723  emsg.Form("Too many saved queries (%d): cannot save %s:%s",
724  fKeptQueries, pq->GetTitle(), pq->GetName());
725  if (gProofServ) {
727  } else {
728  Warning("SaveQuery", "%s", emsg.Data());
729  }
730  }
731  } else {
732  SaveQuery(pq);
733  fKeptQueries++;
734  }
735 }
const char * GetName() const
Returns name of object.
Definition: TObjString.h:42
TList * GetOutputList()
Definition: TQueryResult.h:139
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:823
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1265
virtual void AddAt(TObject *obj, Int_t idx)
Insert object at position idx in the list.
Definition: TList.cxx:268
void RecordEnd(EQueryStatus status, TList *outlist=0)
End of query settings.
Bool_t IsDraw() const
Definition: TQueryResult.h:152
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:404
Int_t GetSeqNum() const
Definition: TQueryResult.h:123
long long Long64_t
Definition: RtypesCore.h:69
TLine * line
Collectable string class.
Definition: TObjString.h:32
float Float_t
Definition: RtypesCore.h:53
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashList.cxx:212
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TSystem.cxx:1363
virtual TList * GetListOfKeys() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:892
Int_t LockSession(const char *sessiontag, TProofLockPath **lck)
Try locking query area of session tagged sessiontag.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
virtual EExitStatus GetExitStatus() const =0
void AddLogFile(TProofQueryResult *pq)
Add part of log file concerning TQueryResult pq to its macro container.
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:821
Regular expression class.
Definition: TRegexp.h:35
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
void AddLogLine(const char *logline)
Fill log file.
EQueryStatus GetStatus() const
Definition: TQueryResult.h:124
void SetVal(const AParamType &val)
Definition: TParameter.h:79
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
Definition: TSystem.cxx:996
bool Bool_t
Definition: RtypesCore.h:59
TQueryResult * CloneInfo()
Return an instance of TQueryResult containing only the local info fields, i.e.
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:496
const char *const kRM
Definition: TProof.h:165
TProofQueryResult * LocateQuery(TString queryref, Int_t &qry, TString &qdir)
Locate query referenced by queryref.
void ScanPreviousQueries(const char *dir)
Scan the queries directory for the results of previous queries.
Long64_t GetBytesRead() const
Definition: TProof.h:962
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3851
const char * Data() const
Definition: TString.h:349
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
Definition: TSystem.cxx:847
#define SafeDelete(p)
Definition: RConfig.h:436
virtual TList * GetOutputList() const =0
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
Definition: TSystem.cxx:1346
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2334
#define PDB(mask, level)
Definition: TProofDebug.h:58
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:36
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
const char *const kPROOF_QueryDir
Definition: TProof.h:151
Int_t CleanupSession(const char *sessiontag)
Cleanup query dir qdir.
Int_t ApplyMaxQueries(Int_t mxq)
Scan the queries directory and remove the oldest ones (and relative dirs, if empty) in such a way onl...
A sorted doubly linked list.
Definition: TSortedList.h:30
Int_t Atoi() const
Return integer value of string.
Definition: TString.cxx:1964
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:30
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
A container class for query results.
Definition: TQueryResult.h:44
void SetResultFile(const char *rf)
char * out
Definition: TBase64.cxx:29
virtual Int_t SendAsynMessage(const char *msg, Bool_t lf=kTRUE)
Send an asychronous message to the master / client .
virtual void SetProcessInfo(Long64_t ent, Float_t cpu=0., Long64_t siz=-1, Float_t inittime=0., Float_t proctime=0.)
Set processing info.
A doubly linked list.
Definition: TList.h:47
Named parameter, streamable and storable.
Definition: TParameter.h:49
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
TProofLockPath * fLock
Float_t GetUsedCPU() const
Definition: TQueryResult.h:133
Bool_t IsArchived() const
Definition: TQueryResult.h:150
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:674
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
char * Form(const char *fmt,...)
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:657
Bool_t FinalizeQuery(TProofQueryResult *pq, TProof *proof, TVirtualProofPlayer *player)
Final steps after Process() to complete the TQueryResult instance.
virtual void FreeDirectory(void *dirp)
Free a directory.
Definition: TSystem.cxx:839
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
TQueryResultManager(const char *qdir, const char *stag, const char *sdir, TProofLockPath *lck, FILE *logfile=0)
Constructor.
double f(double x)
virtual Long64_t GetEventsProcessed() const =0
virtual Int_t ReadKeys(Bool_t forceRead=kTRUE)
Read the linked list of keys.
Definition: TProof.h:339
void RemoveQuery(TQueryResult *qr, Bool_t soft=kFALSE)
Remove everything about query qr.
void SaveQuery(TProofQueryResult *qr, const char *fout=0)
Save current status of query 'qr' to file name fout.
Float_t GetCpuTime() const
Definition: TProof.h:964
const char Int_t const char TProof * proof
Definition: TXSlave.cxx:46
Bool_t IsDigit() const
Returns true if all characters in string are digits (0-9) or white spaces, i.e.
Definition: TString.cxx:1806
virtual ~TQueryResultManager()
Cleanup.
R__EXTERN TProofServ * gProofServ
Definition: TProofServ.h:359
virtual void Add(TObject *obj)
Definition: TList.h:81
const Ssiz_t kNPOS
Definition: Rtypes.h:115
Int_t CleanupQueriesDir()
Remove all queries results referring to previous sessions.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition: TSystem.cxx:830
const AParamType & GetVal() const
Definition: TParameter.h:77
void Add(TObject *obj)
virtual Int_t IndexOf(const TObject *obj) const
const Bool_t kIterBackward
Definition: TCollection.h:44
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:582
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void Close(Option_t *option="")
Close a file.
Definition: TFile.cxx:898
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904