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 from builtins import range
12 import Alignment.MillePedeAlignmentAlgorithm.mpslib.Mpslibclass as mpslib
13 import os
14 
15 # update database
16 os.system("mps_update.py > /dev/null")
17 
18 lib = mpslib.jobdatabase()
19 lib.read_db()
20 
21 # loop over DONE jobs
22 for i in range(len(lib.JOBID)):
23  # check also "FETCH" to recover from possibly failed runs of 'mps_fetch.py'
24  if lib.JOBSTATUS[i] in ("DONE", "EXIT", "FETCH", "DISABLEDFETCH"):
25  # move the LSF output to /jobData/
26  theJobDir = 'jobData/'+lib.JOBDIR[i]
27  theBatchDirectory = r"LSFJOB_"+ lib.JOBID[i]
28 
29  command = 'mv %s/* %s/ > /dev/null 2>&1' % (theBatchDirectory, theJobDir)
30  os.system(command)
31  command = 'rm -rf '+theBatchDirectory
32  os.system(command)
33 
34  # update the status
35  if 'DISABLED' in lib.JOBSTATUS[i]:
36  lib.JOBSTATUS[i] = 'DISABLEDFETCH'
37  else:
38  lib.JOBSTATUS[i] = 'FETCH'
39 
40 lib.write_db()
41 
42 # call mps_check
43 os.system('mps_check.py')
44 
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34