48 JOBNUMBER, JOBDIR, JOBID, JOBSTATUS, JOBNTRY, JOBRUNTIME, JOBNEVT, JOBHOST, JOBINCR, \
49 JOBREMARK, JOBSP1, JOBSP2, JOBSP3 = ([]
for i
in range(13))
51 header, batchScript, cfgTemplate, infiList, classInf, addFiles, driver, mergeScript, \
52 mssDir, updateTimeHuman, mssDirPool, spare1, spare2, spare3 = (
'' for i
in range(14))
54 updateTime, elapsedTime, pedeMem , nJobs = -1, -1, -1, -1
60 DBFILE = open(
'mps.db',
'r')
62 if e.args != (2,
'No such file or directory'):
65 msg = (
"No 'mps.db' found. Make sure you are in a campaign "
66 "directory and that the campaign is set up.")
71 self.
header = DBFILE.readline().strip()
77 self.
driver = DBFILE.readline().rstrip(
'\n')
79 self.
mssDir = DBFILE.readline().rstrip(
'\n')
85 self.
spare1 = DBFILE.readline().rstrip(
'\n')
86 self.
spare2 = DBFILE.readline().rstrip(
'\n')
87 self.
spare3 = DBFILE.readline().rstrip(
'\n')
95 line = line.rstrip(
'\n')
96 parts = line.split(
":")
97 self.JOBNUMBER.append(int(parts[0]))
98 self.JOBDIR.append(parts[1])
99 self.JOBID.append(int(parts[2]))
100 self.JOBSTATUS.append(parts[3])
101 self.JOBNTRY.append(int(parts[4]))
102 self.JOBRUNTIME.append(int(parts[5]))
103 self.JOBNEVT.append(int(parts[6]))
104 self.JOBHOST.append(parts[7])
105 self.JOBINCR.append(int(parts[8]))
106 self.JOBREMARK.append(parts[9])
107 self.JOBSP1.append(parts[10])
108 self.JOBSP2.append(parts[11])
109 self.JOBSP3.append(parts[12])
112 if not self.JOBDIR[self.
nJobs].startswith(
"jobm"):
115 self.
nJobs = milleJobs
125 print "\n=== mps database printout ===\n"
132 print 'driver:\t\t', self.
driver
134 print 'mssDir:\t\t', self.
mssDir
138 print 'pedeMem:\t', self.
pedeMem,
'\n'
141 print '### dir jobid stat try rtime nevt remark weight name'
142 print "------------------------------------------------------------------------------"
143 for i
in xrange(self.
nJobs):
144 print '%03d %6s %9d %6s %3d %5d %8d %8s %5s %s' % (
157 if self.
driver ==
'merge':
158 for i
in xrange(self.
nJobs,len(self.JOBDIR)):
159 print '%s %6s %9d %6s %3d %5d %8d %8s %5s %s' % (
172 totalEvents = sum(self.JOBNEVT[:self.
nJobs])
173 totalCpu = sum(self.JOBRUNTIME[:self.
nJobs])
176 meanCpuPerEvent = float(totalCpu)/totalEvents
177 print "------------------------------------------------------------------------------"
178 print "\t\t\t\t\tEvent total:\t", totalEvents
179 print "\t\t\t\t\tCPU total:\t", totalCpu,
's'
180 print "\t\t\t\t\tMean CPU/event:\t",meanCpuPerEvent,
's'
189 self.
header =
"mps database schema 3.2"
196 self.
spare1 =
"-- unused --"
197 self.
spare2 =
"-- unused --"
198 self.
spare3 =
"-- unused --"
201 os.system(
'[[ -a mps.db ]] && cp -p mps.db mps.db~')
204 DBFILE = open (
"mps.db",
"w")
210 for item
in headData:
211 DBFILE.write(
"%s\n" % item)
214 for i
in xrange(len(self.JOBID)):
215 DBFILE.write(
'%03d:%s:%05d:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n' %
235 CLASSES = self.classInf.split(
':')
236 if len(CLASSES)<1
or len(CLASSES)>2:
237 print '\nget_class():\n class must be of the form \'class\' or \'classMille:classPede\', but is \'%s\'!\n\n', classInf
239 elif argument ==
'mille':
241 elif argument ==
'pede':
242 if len(CLASSES) == 1:
244 elif len(CLASSES) == 2:
247 print '\nget_class():\n Know class only for \'mille\' or \'pede\', not %s!\n\n' %argument