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 if line.strip() ==
"":
continue 100 line = line.rstrip(
'\n')
101 parts = line.split(
":")
102 self.JOBNUMBER.append(
int(parts[0]))
103 self.JOBDIR.append(parts[1].
strip())
104 self.JOBID.append(parts[2])
105 self.JOBSTATUS.append(parts[3].
strip())
106 self.JOBNTRY.append(
int(parts[4]))
107 self.JOBRUNTIME.append(
int(parts[5]))
108 self.JOBNEVT.append(
int(parts[6]))
109 self.JOBHOST.append(parts[7].
strip())
110 self.JOBINCR.append(
int(parts[8]))
111 self.JOBREMARK.append(parts[9].
strip())
112 self.JOBSP1.append(parts[10].
strip())
113 self.JOBSP2.append(parts[11].
strip())
114 self.JOBSP3.append(parts[12].
strip())
117 if not self.JOBDIR[self.
nJobs].startswith(
"jobm"):
120 self.
nJobs = milleJobs
130 print "\n=== mps database printout ===\n" 137 print 'driver:\t\t', self.
driver 139 print 'mssDir:\t\t', self.
mssDir 143 print 'pedeMem:\t', self.
pedeMem,
'\n' 146 print '### dir jobid stat try rtime nevt remark weight name' 147 print "------------------------------------------------------------------------------" 148 for i
in xrange(self.
nJobs):
149 print '%03d %6s %9s %6s %3d %5d %8d %8s %5s %s' % (
162 if self.
driver ==
'merge':
163 for i
in xrange(self.
nJobs,len(self.JOBDIR)):
164 print '%s %6s %9s %6s %3d %5d %8d %8s %5s %s' % (
177 totalEvents = sum(self.JOBNEVT[:self.
nJobs])
178 totalCpu = sum(self.JOBRUNTIME[:self.
nJobs])
181 meanCpuPerEvent =
float(totalCpu)/totalEvents
182 print "------------------------------------------------------------------------------" 183 print "\t\t\t\t\tEvent total:\t", totalEvents
184 print "\t\t\t\t\tCPU total:\t", totalCpu,
's' 185 print "\t\t\t\t\tMean CPU/event:\t",meanCpuPerEvent,
's' 194 self.
header =
"mps database schema 3.2" 201 self.
spare1 =
"-- unused --" 202 self.
spare2 =
"-- unused --" 203 self.
spare3 =
"-- unused --" 206 os.system(
'[[ -a mps.db ]] && cp -p mps.db mps.db~')
209 DBFILE = open (
"mps.db",
"w")
215 for item
in headData:
216 DBFILE.write(
"%s\n" % item)
219 for i
in xrange(len(self.JOBID)):
220 DBFILE.write(
'%03d:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n' %
240 CLASSES = self.classInf.split(
':')
241 if len(CLASSES)<1
or len(CLASSES)>2:
242 print '\nget_class():\n class must be of the form \'class\' or \'classMille:classPede\', but is \'%s\'!\n\n', classInf
244 elif argument ==
'mille':
246 elif argument ==
'pede':
247 if len(CLASSES) == 1:
249 elif len(CLASSES) == 2:
252 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='')