CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  if 'DONE' in lib.JOBSTATUS[i]:
23  # move the LSF output to /jobData/
24  theJobDir = 'jobData/'+lib.JOBDIR[i]
25  theBatchDirectory = 'LSFJOB\_%d' % lib.JOBID[i]
26 
27  command = 'mv %s/* %s/' % (theBatchDirectory, theJobDir)
28  os.system(command)
29  command = 'rmdir '+theBatchDirectory
30  os.system(command)
31 
32  # update the status
33  if 'DISABLED' in lib.JOBSTATUS[i]:
34  lib.JOBSTATUS[i] = 'DISABLEDFETCH'
35  else:
36  lib.JOBSTATUS[i] = 'FETCH'
37 
38 lib.write_db()
39 
40 # call mps_check
41 os.system('mps_check.py')
42