5 import Alignment.MillePedeAlignmentAlgorithm.mpslib.Mpslibclass
as mpslib
7 lib = mpslib.jobdatabase()
19 for i
in xrange(len(lib.JOBID)):
20 if 'SETUP' in lib.JOBSTATUS[i]
or \
21 'DONE' in lib.JOBSTATUS[i]
or \
22 'FETCH' in lib.JOBSTATUS[i]
or \
23 'OK' in lib.JOBSTATUS[i]
or \
24 'ABEND' in lib.JOBSTATUS[i]
or \
25 'FAIL' in lib.JOBSTATUS[i]:
30 print "submitted jobs: ", submittedjobs
39 bjobs = subprocess.check_output(
'bjobs -l', stderr=subprocess.STDOUT, shell=
True)
40 bjobs = bjobs.replace(
'\n',
'')
42 if bjobs !=
'No unfinished job found':
43 bjobs = bjobs.replace(
' ',
'')
44 results = bjobs.split(
'-----------------------')
51 match = re.search(
'Job<(\d+?)>,', line)
53 jobid = int(match.group(1))
55 match = re.search(
'Status<([A-Z]+?)>', line)
57 status = match.group(1)
59 match = re.search(
'TheCPUtimeusedis(\d+?)seconds', line)
62 cputime = int(match.group(1))
63 print 'out ', jobid,
' ', status,
' ', cputime
68 for k
in xrange(len(lib.JOBID)):
69 if jobid == lib.JOBID[k]:
71 if 'DISABLED' in lib.JOBSTATUS[theIndex]:
76 print 'mps_update.py - the job ', jobid,
' was not found in the JOBID array'
78 if FLAG[theIndex] == 1:
82 lib.JOBSTATUS[theIndex] = disabled+status
83 if status ==
'RUN' or status ==
'DONE':
85 diff = cputime - lib.JOBRUNTIME[theIndex]
86 lib.JOBRUNTIME[theIndex] = cputime
87 lib.JOBHOST[theIndex] =
'+'+str(diff)
88 lib.JOBINCR[theIndex] = diff
90 lib.JOBRUNTIME[theIndex] = 0
91 lib.JOBINCR[theIndex] = 0
93 print 'set flag of job', theIndex,
'with id', lib.JOBID[theIndex],
'to 1'
98 for i
in xrange(len(lib.JOBID)):
102 if 'DISABLED' in lib.JOBSTATUS[i]:
103 disabled =
'DISABLED'
104 print ' DB job ', lib.JOBID[i],
'flag ', FLAG[i]
110 theBatchDirectory =
'LSFJOB_'+str(lib.JOBID[i])
111 if os.path.isdir(theBatchDirectory):
112 print 'Directory ', theBatchDirectory,
'exists'
113 lib.JOBSTATUS[i] = disabled +
'DONE'
115 if 'RUN' in lib.JOBSTATUS[i]:
116 print 'WARNING: Job ',i,
' in state RUN, neither found by bjobs nor find LSFJOB directory!'
124 for i
in xrange(len(lib.JOBID)):
126 if 'SETUP' in lib.JOBSTATUS[i]
or \
127 'DONE' in lib.JOBSTATUS[i]
or \
128 'FETCH' in lib.JOBSTATUS[i]
or \
129 'TIMEL' in lib.JOBSTATUS[i]
or \
130 'SUBTD' in lib.JOBSTATUS[i]:
131 print 'Funny entry index ',i,
' job ',lib.JOBID[i],
' status ',lib.JOBSTATUS[i]