Public Member Functions | Public Attributes | List of all members
python.stagestatus.StageStatus Class Reference

Public Member Functions

def __init__ (self, stage)
 
def update (self)
 

Public Attributes

 stage
 
 exists
 
 nfile
 
 nev
 
 nana
 
 nerror
 
 nmiss
 

Detailed Description

Definition at line 21 of file stagestatus.py.

Constructor & Destructor Documentation

def python.stagestatus.StageStatus.__init__ (   self,
  stage 
)

Definition at line 25 of file stagestatus.py.

25  def __init__(self, stage):
26 
27  # Default values.
28 
29  self.stage = stage # Stage name.
30  self.exists = False # Does bookdir exist?
31  self.nfile = 0 # Number of good art files.
32  self.nev = 0 # Number of good art events.
33  self.nana = 0 # Number of good non-art root files.
34  self.nerror = 0 # Number of workers with errors.
35  self.nmiss = 0 # Number of unprocessed input files.
36 
37  # Update data.
38 
39  self.update()
40 

Member Function Documentation

def python.stagestatus.StageStatus.update (   self)

Definition at line 43 of file stagestatus.py.

43  def update(self):
44 
45  bookdir = self.stage.bookdir
46 
47  # Test whether output directory exists.
48 
49  if larbatch_posix.exists(bookdir):
50 
51  # Output directory exists.
52 
53  self.exists = True
54  self.nfile = 0
55  self.nev = 0
56  self.nana = 0
57  self.nerror = 0
58  self.nmiss = 0
59 
60  # Count good files and events.
61 
62  eventsfile = os.path.join(bookdir, 'events.list')
63  if larbatch_posix.exists(eventsfile):
64  lines = larbatch_posix.readlines(eventsfile)
65  for line in lines:
66  words = line.split()
67  if len(words) >= 2:
68  self.nfile = self.nfile + 1
69  self.nev = self.nev + int(words[1])
70 
71  # Count good files analysis root files.
72 
73  filesana = os.path.join(bookdir, 'filesana.list')
74  if larbatch_posix.exists(filesana):
75  lines = larbatch_posix.readlines(filesana)
76  for line in lines:
77  self.nana = self.nana + 1
78 
79  # Count errors.
80 
81  badfile = os.path.join(bookdir, 'bad.list')
82  if larbatch_posix.exists(badfile):
83  lines = larbatch_posix.readlines(badfile)
84  for line in lines:
85  if line.strip():
86  self.nerror += 1
87 
88  # Count missing files.
89 
90  missingfile = os.path.join(bookdir, 'missing_files.list')
91  if larbatch_posix.exists(missingfile):
92  lines = larbatch_posix.readlines(missingfile)
93  for line in lines:
94  if line.strip():
95  self.nmiss += 1
96 
97  else:
98 
99  # Output directory does not exist.
100 
101  self.exists = False
102 

Member Data Documentation

python.stagestatus.StageStatus.exists

Definition at line 30 of file stagestatus.py.

python.stagestatus.StageStatus.nana

Definition at line 33 of file stagestatus.py.

python.stagestatus.StageStatus.nerror

Definition at line 34 of file stagestatus.py.

python.stagestatus.StageStatus.nev

Definition at line 32 of file stagestatus.py.

python.stagestatus.StageStatus.nfile

Definition at line 31 of file stagestatus.py.

python.stagestatus.StageStatus.nmiss

Definition at line 35 of file stagestatus.py.

python.stagestatus.StageStatus.stage

Definition at line 29 of file stagestatus.py.


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