CMS 3D CMS Logo

mps_fetch.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 #
4 # Fetch jobs that have DONE status
5 # This step is mainly foreseen in case job result files need
6 # to be copied from a spool area.
7 # On LSF batch, the job output is already in our directories,
8 # hence this function does hardly anything except for calling
9 # mps_check.py.
10 
11 import Alignment.MillePedeAlignmentAlgorithm.mpslib.Mpslibclass as mpslib
12 import os
13 
14 # update database
15 os.system("mps_update.py > /dev/null")
16 
17 lib = mpslib.jobdatabase()
18 lib.read_db()
19 
20 # loop over DONE jobs
21 for i in xrange(len(lib.JOBID)):
22  # check also "FETCH" to recover from possibly failed runs of 'mps_fetch.py'
23  if lib.JOBSTATUS[i] in ("DONE", "FETCH", "DISABLEDFETCH"):
24  # move the LSF output to /jobData/
25  theJobDir = 'jobData/'+lib.JOBDIR[i]
26  theBatchDirectory = 'LSFJOB\_%d' % lib.JOBID[i]
27 
28  command = 'mv %s/* %s/' % (theBatchDirectory, theJobDir)
29  os.system(command)
30  command = 'rmdir '+theBatchDirectory
31  os.system(command)
32 
33  # update the status
34  if 'DISABLED' in lib.JOBSTATUS[i]:
35  lib.JOBSTATUS[i] = 'DISABLEDFETCH'
36  else:
37  lib.JOBSTATUS[i] = 'FETCH'
38 
39 lib.write_db()
40 
41 # call mps_check
42 os.system('mps_check.py')
43