1 from __future__
import print_function
49 JOBNUMBER, JOBDIR, JOBID, JOBSTATUS, JOBNTRY, JOBRUNTIME, JOBNEVT, JOBHOST, JOBINCR, \
50 JOBREMARK, JOBSP1, JOBSP2, JOBSP3 = ([]
for i
in range(13))
52 header, batchScript, cfgTemplate, infiList, classInf, addFiles, driver, mergeScript, \
53 mssDir, updateTimeHuman, mssDirPool, spare1, spare2, spare3 = (
'' for i
in range(14))
55 updateTime, elapsedTime, pedeMem , nJobs = -1, -1, -1, -1
59 __default_db_file_name =
"mps.db" 60 def read_db(self, db_file_name = __default_db_file_name):
62 DBFILE = open(db_file_name,
'r') 64 if e.args != (2,
'No such file or directory'):
67 if db_file_name == jobdatabase.__default_db_file_name:
68 msg = (
"No 'mps.db' found. Make sure you are in a campaign " 69 "directory and that the campaign is set up.")
71 msg =
"Database file '"+db_file_name+
"' not found. Exiting." 82 self.
driver = DBFILE.readline().rstrip(
'\n')
84 self.
mssDir = DBFILE.readline().rstrip(
'\n')
88 self.
mssDirPool = DBFILE.readline().rstrip(
'\n')
90 self.
spare1 = DBFILE.readline().rstrip(
'\n')
91 self.
spare2 = DBFILE.readline().rstrip(
'\n')
92 self.
spare3 = DBFILE.readline().rstrip(
'\n')
100 if line.strip() ==
"":
continue 101 line = line.rstrip(
'\n')
102 parts = line.split(
":")
103 self.JOBNUMBER.append(
int(parts[0]))
104 self.JOBDIR.append(parts[1].
strip())
105 self.JOBID.append(parts[2])
106 self.JOBSTATUS.append(parts[3].
strip())
107 self.JOBNTRY.append(
int(parts[4]))
108 self.JOBRUNTIME.append(
int(parts[5]))
109 self.JOBNEVT.append(
int(parts[6]))
110 self.JOBHOST.append(parts[7].
strip())
111 self.JOBINCR.append(
int(parts[8]))
112 self.JOBREMARK.append(parts[9].
strip())
113 self.JOBSP1.append(parts[10].
strip())
114 self.JOBSP2.append(parts[11].
strip())
115 self.JOBSP3.append(parts[12].
strip())
118 if not self.JOBDIR[self.
nJobs].startswith(
"jobm"):
121 self.
nJobs = milleJobs
131 print(
"\n=== mps database printout ===\n")
147 print(
'### dir jobid stat try rtime nevt remark weight name')
148 print(
"------------------------------------------------------------------------------")
149 for i
in xrange(self.
nJobs):
150 print(
'%03d %6s %9s %6s %3d %5d %8d %8s %5s %s' % (
163 if self.
driver ==
'merge':
164 for i
in xrange(self.
nJobs,len(self.JOBDIR)):
165 print(
'%s %6s %9s %6s %3d %5d %8d %8s %5s %s' % (
178 totalEvents = sum(self.JOBNEVT[:self.
nJobs])
179 totalCpu = sum(self.JOBRUNTIME[:self.
nJobs])
182 meanCpuPerEvent =
float(totalCpu)/totalEvents
183 print(
"------------------------------------------------------------------------------")
184 print(
"\t\t\t\t\tEvent total:\t", totalEvents)
185 print(
"\t\t\t\t\tCPU total:\t", totalCpu,
's')
186 print(
"\t\t\t\t\tMean CPU/event:\t",meanCpuPerEvent,
's')
195 self.
header =
"mps database schema 3.2" 202 self.
spare1 =
"-- unused --" 203 self.
spare2 =
"-- unused --" 204 self.
spare3 =
"-- unused --" 207 os.system(
'[[ -a mps.db ]] && cp -p mps.db mps.db~')
210 DBFILE = open (
"mps.db",
"w")
216 for item
in headData:
217 DBFILE.write(
"%s\n" % item)
220 for i
in xrange(len(self.JOBID)):
221 DBFILE.write(
'%03d:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n' %
241 CLASSES = self.classInf.split(
':')
242 if len(CLASSES)<1
or len(CLASSES)>2:
243 print(
'\nget_class():\n class must be of the form \'class\' or \'classMille:classPede\', but is \'%s\'!\n\n', classInf)
245 elif argument ==
'mille':
247 elif argument ==
'pede':
248 if len(CLASSES) == 1:
250 elif len(CLASSES) == 2:
253 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)
S & print(S &os, JobReport::InputFile const &f)
def get_class(self, argument='')