1 from __future__
import print_function
41 from builtins
import range
50 JOBNUMBER, JOBDIR, JOBID, JOBSTATUS, JOBNTRY, JOBRUNTIME, JOBNEVT, JOBHOST, JOBINCR, \
51 JOBREMARK, JOBSP1, JOBSP2, JOBSP3 = ([]
for i
in range(13))
53 header, batchScript, cfgTemplate, infiList, classInf, addFiles, driver, mergeScript, \
54 mssDir, updateTimeHuman, mssDirPool, spare1, spare2, spare3 = (
'' for i
in range(14))
56 updateTime, elapsedTime, pedeMem , nJobs = -1, -1, -1, -1
60 __default_db_file_name =
"mps.db"
61 def read_db(self, db_file_name = __default_db_file_name):
63 DBFILE = open(db_file_name,
'r')
65 if e.args != (2,
'No such file or directory'):
68 if db_file_name == jobdatabase.__default_db_file_name:
69 msg = (
"No 'mps.db' found. Make sure you are in a campaign "
70 "directory and that the campaign is set up.")
72 msg =
"Database file '"+db_file_name+
"' not found. Exiting."
83 self.
driver = DBFILE.readline().rstrip(
'\n')
85 self.
mssDir = DBFILE.readline().rstrip(
'\n')
91 self.
spare1 = DBFILE.readline().rstrip(
'\n')
92 self.
spare2 = DBFILE.readline().rstrip(
'\n')
93 self.
spare3 = DBFILE.readline().rstrip(
'\n')
101 if line.strip() ==
"":
continue
102 line = line.rstrip(
'\n')
103 parts = line.split(
":")
104 self.JOBNUMBER.append(int(parts[0]))
105 self.JOBDIR.append(parts[1].
strip())
106 self.JOBID.append(parts[2])
107 self.JOBSTATUS.append(parts[3].
strip())
108 self.JOBNTRY.append(int(parts[4]))
109 self.JOBRUNTIME.append(int(parts[5]))
110 self.JOBNEVT.append(int(parts[6]))
111 self.JOBHOST.append(parts[7].
strip())
112 self.JOBINCR.append(int(parts[8]))
113 self.JOBREMARK.append(parts[9].
strip())
114 self.JOBSP1.append(parts[10].
strip())
115 self.JOBSP2.append(parts[11].
strip())
116 self.JOBSP3.append(parts[12].
strip())
119 if not self.JOBDIR[self.
nJobs].startswith(
"jobm"):
122 self.
nJobs = milleJobs
132 print(
"\n=== mps database printout ===\n")
148 print(
'### dir jobid stat try rtime nevt remark weight name')
149 print(
"------------------------------------------------------------------------------")
151 print(
'%03d %6s %9s %6s %3d %5d %8d %8s %5s %s' % (
164 if self.
driver ==
'merge':
166 print(
'%s %6s %9s %6s %3d %5d %8d %8s %5s %s' % (
179 totalEvents = sum(self.JOBNEVT[:self.
nJobs])
180 totalCpu = sum(self.JOBRUNTIME[:self.
nJobs])
183 meanCpuPerEvent = float(totalCpu)/totalEvents
184 print(
"------------------------------------------------------------------------------")
185 print(
"\t\t\t\t\tEvent total:\t", totalEvents)
186 print(
"\t\t\t\t\tCPU total:\t", totalCpu,
's')
187 print(
"\t\t\t\t\tMean CPU/event:\t",meanCpuPerEvent,
's')
196 self.
header =
"mps database schema 3.2"
203 self.
spare1 =
"-- unused --"
204 self.
spare2 =
"-- unused --"
205 self.
spare3 =
"-- unused --"
208 os.system(
'[[ -a mps.db ]] && cp -p mps.db mps.db~')
211 DBFILE = open (
"mps.db",
"w")
217 for item
in headData:
218 DBFILE.write(
"%s\n" % item)
221 for i
in range(len(self.JOBID)):
222 DBFILE.write(
'%03d:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n' %
242 CLASSES = self.classInf.split(
':')
243 if len(CLASSES)<1
or len(CLASSES)>2:
244 print(
'\nget_class():\n class must be of the form \'class\' or \'classMille:classPede\', but is \'%s\'!\n\n', classInf)
246 elif argument ==
'mille':
248 elif argument ==
'pede':
249 if len(CLASSES) == 1:
251 elif len(CLASSES) == 2:
254 print(
'\nget_class():\n Know class only for \'mille\' or \'pede\', not %s!\n\n' %argument)
const uint16_t range(const Frame &aFrame)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)