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
58 __default_db_file_name =
"mps.db" 59 def read_db(self, db_file_name = __default_db_file_name):
61 DBFILE = open(db_file_name,
'r') 63 if e.args != (2,
'No such file or directory'):
66 if db_file_name == jobdatabase.__default_db_file_name:
67 msg = (
"No 'mps.db' found. Make sure you are in a campaign " 68 "directory and that the campaign is set up.")
70 msg =
"Database file '"+db_file_name+
"' not found. Exiting." 81 self.
driver = DBFILE.readline().rstrip(
'\n')
83 self.
mssDir = DBFILE.readline().rstrip(
'\n')
87 self.
mssDirPool = DBFILE.readline().rstrip(
'\n')
89 self.
spare1 = DBFILE.readline().rstrip(
'\n')
90 self.
spare2 = DBFILE.readline().rstrip(
'\n')
91 self.
spare3 = DBFILE.readline().rstrip(
'\n')
99 line = line.rstrip(
'\n')
100 parts = line.split(
":")
101 self.JOBNUMBER.append(
int(parts[0]))
102 self.JOBDIR.append(parts[1].
strip())
103 self.JOBID.append(parts[2])
104 self.JOBSTATUS.append(parts[3].
strip())
105 self.JOBNTRY.append(
int(parts[4]))
106 self.JOBRUNTIME.append(
int(parts[5]))
107 self.JOBNEVT.append(
int(parts[6]))
108 self.JOBHOST.append(parts[7].
strip())
109 self.JOBINCR.append(
int(parts[8]))
110 self.JOBREMARK.append(parts[9].
strip())
111 self.JOBSP1.append(parts[10].
strip())
112 self.JOBSP2.append(parts[11].
strip())
113 self.JOBSP3.append(parts[12].
strip())
116 if not self.JOBDIR[self.
nJobs].startswith(
"jobm"):
119 self.
nJobs = milleJobs
129 print "\n=== mps database printout ===\n" 136 print 'driver:\t\t', self.
driver 138 print 'mssDir:\t\t', self.
mssDir 142 print 'pedeMem:\t', self.
pedeMem,
'\n' 145 print '### dir jobid stat try rtime nevt remark weight name' 146 print "------------------------------------------------------------------------------" 147 for i
in xrange(self.
nJobs):
148 print '%03d %6s %9s %6s %3d %5d %8d %8s %5s %s' % (
161 if self.
driver ==
'merge':
162 for i
in xrange(self.
nJobs,len(self.JOBDIR)):
163 print '%s %6s %9s %6s %3d %5d %8d %8s %5s %s' % (
176 totalEvents = sum(self.JOBNEVT[:self.
nJobs])
177 totalCpu = sum(self.JOBRUNTIME[:self.
nJobs])
180 meanCpuPerEvent =
float(totalCpu)/totalEvents
181 print "------------------------------------------------------------------------------" 182 print "\t\t\t\t\tEvent total:\t", totalEvents
183 print "\t\t\t\t\tCPU total:\t", totalCpu,
's' 184 print "\t\t\t\t\tMean CPU/event:\t",meanCpuPerEvent,
's' 193 self.
header =
"mps database schema 3.2" 200 self.
spare1 =
"-- unused --" 201 self.
spare2 =
"-- unused --" 202 self.
spare3 =
"-- unused --" 205 os.system(
'[[ -a mps.db ]] && cp -p mps.db mps.db~')
208 DBFILE = open (
"mps.db",
"w")
214 for item
in headData:
215 DBFILE.write(
"%s\n" % item)
218 for i
in xrange(len(self.JOBID)):
219 DBFILE.write(
'%03d:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n' %
239 CLASSES = self.classInf.split(
':')
240 if len(CLASSES)<1
or len(CLASSES)>2:
241 print '\nget_class():\n class must be of the form \'class\' or \'classMille:classPede\', but is \'%s\'!\n\n', classInf
243 elif argument ==
'mille':
245 elif argument ==
'pede':
246 if len(CLASSES) == 1:
248 elif len(CLASSES) == 2:
251 print '\nget_class():\n Know class only for \'mille\' or \'pede\', not %s!\n\n' %argument
def read_db(self, db_file_name=__default_db_file_name)
def get_class(self, argument='')