Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TAlienMasterJobStatus.cxx
Go to the documentation of this file.
1// @(#)root/alien:$Id$
2// Author: Jan Fiete Grosse-Oetringhaus 06/10/2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, 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// TAlienMasterJobStatus //
15// //
16// Status of a MasterJob //
17// //
18//////////////////////////////////////////////////////////////////////////
19
20#include "TAlienJobStatus.h"
22#include "TObjString.h"
23#include "TBrowser.h"
24
26
27////////////////////////////////////////////////////////////////////////////////
28/// Cleanup.
29
31{
33
34 if (fMasterJob)
35 delete fMasterJob;
36}
37
38////////////////////////////////////////////////////////////////////////////////
39/// Browser interface.
40
42{
43 if (b) {
44 // TString status("");
45 // status += GetStatus();
46 // b->Add(new TNamed(status, TString("overall status")));
47 // status = "";
48 // status += PercentFinished();
49 // b->Add(new TNamed(status, TString("percentage finished")));
50
52
53 TObject* obj = 0;
54 while ((obj = iter->Next()) != 0) {
55 TObjString* keyStr = dynamic_cast<TObjString*>(obj);
56 TObject* value = fJobs.GetValue(obj);
57
58 if (keyStr && value)
59 b->Add(value, keyStr->GetString().Data());
60 }
61 delete iter;
62 }
63}
64
65////////////////////////////////////////////////////////////////////////////////
66/// Returns the status of the master job reduced to the subset defined
67/// in TGridJobStatus.
68
70{
71 if (!fMasterJob)
72 return kUNKNOWN;
73
74 return fMasterJob->GetStatus();
75}
76
77////////////////////////////////////////////////////////////////////////////////
78/// Returns the percentage of finished subjobs, only DONE is considered
79/// as finished.
80
82{
83 if (fJobs.GetSize() == 0)
84 return 0;
85
87
88 Int_t done = 0;
89
90 TObject* obj = 0;
91 while ((obj = iter->Next()) != 0) {
92 TObject* value = fJobs.GetValue(obj);
93 TAlienJobStatus* jobStatus = dynamic_cast<TAlienJobStatus*>(value);
94
95 if (jobStatus) {
96 if (jobStatus->GetStatus() == kDONE)
97 ++done;
98 }
99 }
100
101 delete iter;
102
103 return (Float_t) done / fJobs.GetSize();
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Prints information of the master job and the sub job. Only the status is printed.
108
110{
111 if (fMasterJob) {
112 printf("Printing information for the master job: ");
114 }
115
116 TIterator* iter = fJobs.MakeIterator();
117
118 TObject* obj = 0;
119 while ((obj = iter->Next()) != 0) {
120 TObjString* keyStr = dynamic_cast<TObjString*>(obj);
121
122 TObject* value = fJobs.GetValue(obj);
123 TAlienJobStatus* jobStatus = dynamic_cast<TAlienJobStatus*>(value);
124
125 if (keyStr && jobStatus) {
126 printf("Printing info for subjob %s: ", keyStr->GetString().Data());
127 jobStatus->PrintJob(kFALSE);
128 }
129 }
130 delete iter;
131}
#define b(i)
Definition RSha256.hxx:100
const Bool_t kFALSE
Definition RtypesCore.h:92
float Float_t
Definition RtypesCore.h:57
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
void PrintJob(Bool_t full=kTRUE) const
Prints this job.
virtual EGridJobStatus GetStatus() const
Gets the status of the job reduced to the subset defined in TGridJobStatus.
void Browse(TBrowser *b)
Browser interface.
virtual ~TAlienMasterJobStatus()
Cleanup.
EGridJobStatus GetStatus() const
Returns the status of the master job reduced to the subset defined in TGridJobStatus.
Float_t PercentFinished()
Returns the percentage of finished subjobs, only DONE is considered as finished.
void Print(Option_t *) const
Prints information of the master job and the sub job. Only the status is printed.
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Iterator abstract base class.
Definition TIterator.h:30
virtual TObject * Next()=0
void DeleteAll()
Remove all (key,value) pairs from the map AND delete the keys AND values when they are allocated on t...
Definition TMap.cxx:168
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Create an iterator for TMap.
Definition TMap.cxx:258
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Definition TMap.cxx:236
Collectable string class.
Definition TObjString.h:28
const TString & GetString() const
Definition TObjString.h:46
Mother of all ROOT objects.
Definition TObject.h:37
const char * Data() const
Definition TString.h:369