Loading [MathJax]/extensions/tex2jax.js
ROOT
6.06/09
Reference Guide
ROOT Home Page
Main Page
Related Pages
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
net
alien
src
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
"
21
#include "
TAlienMasterJobStatus.h
"
22
#include "
TObjString.h
"
23
#include "
TBrowser.h
"
24
25
ClassImp
(
TAlienMasterJobStatus
)
26
27
////////////////////////////////////////////////////////////////////////////////
28
/// Cleanup.
29
30
TAlienMasterJobStatus
::~
TAlienMasterJobStatus
()
31
{
32
fJobs.DeleteAll();
33
34
if
(fMasterJob)
35
delete
fMasterJob;
36
}
37
38
////////////////////////////////////////////////////////////////////////////////
39
/// Browser interface.
40
41
void
TAlienMasterJobStatus::Browse
(
TBrowser
* b)
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
51
TIterator
*
iter
=
fJobs
.
MakeIterator
();
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
69
TGridJobStatus::EGridJobStatus
TAlienMasterJobStatus::GetStatus
()
const
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
81
Float_t
TAlienMasterJobStatus::PercentFinished
()
82
{
83
if
(
fJobs
.
GetSize
() == 0)
84
return
0;
85
86
TIterator
*
iter
=
fJobs
.
MakeIterator
();
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
109
void
TAlienMasterJobStatus::Print
(
Option_t
*)
const
110
{
111
if
(
fMasterJob
) {
112
printf
(
"Printing information for the master job: "
);
113
fMasterJob
->
PrintJob
(
kFALSE
);
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
}
TBrowser::Add
void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add object with name to browser.
Definition:
TBrowser.cxx:259
TAlienMasterJobStatus::fJobs
TMap fJobs
Definition:
TAlienMasterJobStatus.h:40
TAlienJobStatus.h
TObjString
Collectable string class.
Definition:
TObjString.h:32
TAlienMasterJobStatus::GetStatus
EGridJobStatus GetStatus() const
Returns the status of the master job reduced to the subset defined in TGridJobStatus.
Definition:
TAlienMasterJobStatus.cxx:69
Float_t
float Float_t
Definition:
RtypesCore.h:53
Option_t
const char Option_t
Definition:
RtypesCore.h:62
TBrowser.h
TAlienMasterJobStatus::PercentFinished
Float_t PercentFinished()
Returns the percentage of finished subjobs, only DONE is considered as finished.
Definition:
TAlienMasterJobStatus.cxx:81
Int_t
int Int_t
Definition:
RtypesCore.h:41
kFALSE
const Bool_t kFALSE
Definition:
Rtypes.h:92
ClassImp
ClassImp(TAlienMasterJobStatus) TAlienMasterJobStatus
Cleanup.
Definition:
TAlienMasterJobStatus.cxx:25
TIterator
Iterator abstract base class.
Definition:
TIterator.h:32
TAlienJobStatus::PrintJob
void PrintJob(Bool_t full=kTRUE) const
Prints this job.
Definition:
TAlienJobStatus.cxx:190
TString::Data
const char * Data() const
Definition:
TString.h:349
iter
std::map< std::string, std::string >::const_iterator iter
Definition:
TAlienJob.cxx:54
TAlienMasterJobStatus::fMasterJob
TAlienJobStatus * fMasterJob
Definition:
TAlienMasterJobStatus.h:39
TMap::GetValue
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Definition:
TMap.cxx:234
TAlienMasterJobStatus.h
TBrowser
Using a TBrowser one can browse all ROOT objects.
Definition:
TBrowser.h:41
TObjString.h
TGridJobStatus::EGridJobStatus
EGridJobStatus
Definition:
TGridJobStatus.h:32
TObjString::GetString
TString GetString() const
Definition:
TObjString.h:50
TMap::MakeIterator
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Create an iterator for TMap.
Definition:
TMap.cxx:256
TGridJobStatus::kUNKNOWN
Definition:
TGridJobStatus.h:32
TAlienJobStatus::GetStatus
virtual EGridJobStatus GetStatus() const
Gets the status of the job reduced to the subset defined in TGridJobStatus.
Definition:
TAlienJobStatus.cxx:142
TAlienMasterJobStatus::Browse
void Browse(TBrowser *b)
Browser interface.
Definition:
TAlienMasterJobStatus.cxx:41
TCollection::GetSize
virtual Int_t GetSize() const
Definition:
TCollection.h:95
printf
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
TObject
Mother of all ROOT objects.
Definition:
TObject.h:58
TAlienMasterJobStatus::Print
void Print(Option_t *) const
Prints information of the master job and the sub job. Only the status is printed. ...
Definition:
TAlienMasterJobStatus.cxx:109
TIterator::Next
virtual TObject * Next()=0
TAlienMasterJobStatus
Definition:
TAlienMasterJobStatus.h:34
TGridJobStatus::kDONE
Definition:
TGridJobStatus.h:32
TAlienJobStatus
Definition:
TAlienJobStatus.h:34
obj
TObject * obj
Definition:
TStreamerInfo.cxx:83
value
float value
Definition:
math.cpp:443