CMS 3D CMS Logo

Classes | Functions | Variables
cmsBatch Namespace Reference

Classes

class  CmsBatchException
 
class  MyBatchManager
 

Functions

def batchScriptCCIN2P3 ()
 
def batchScriptCERN (remoteDir, index)
 
def batchScriptLocal (remoteDir, index)
 
def rootfiles_to_eos_script (index, remoteDir)
 

Variables

 action
 
 args
 
 argv
 
 batchManager
 
 cfgFile
 
 cfgFileName
 
 cfo
 
 default
 
 dest
 batchManager.parser_.add_option("-b", "--batch", dest="batch", help="batch command. default is: 'bsub -q 8nh < batchScript.sh'. You can also use 'nohup < ./batchScript.sh &' to run locally.", default="bsub -q 8nh < .batchScript.sh") More...
 
 doCVSTag
 
 file
 
 fullSource
 
 generator
 
 grouping
 
 handle
 
 help
 
 listOfValues
 
 log
 
 logDir
 
 nFiles
 
 nJobs
 
 oldPwd
 
 options
 
 process
 
 prog
 
 pycfg_params
 
 runningMode
 
 True
 
 trueArgv
 
 usage
 
 waitingTime
 

Function Documentation

◆ batchScriptCCIN2P3()

def cmsBatch.batchScriptCCIN2P3 ( )

Definition at line 19 of file cmsBatch.py.

19 def batchScriptCCIN2P3():
20  script = """!/usr/bin/env bash
21 #PBS -l platform=LINUX,u_sps_cmsf,M=2000MB,T=2000000
22 # sets the queue
23 #PBS -q T
24 #PBS -eo
25 #PBS -me
26 #PBS -V
27 
28 source $HOME/.bash_profile
29 
30 echo '***********************'
31 
32 ulimit -v 3000000
33 
34 # coming back to submission dir do setup the env
35 cd $PBS_O_WORKDIR
36 eval `scramv1 ru -sh`
37 
38 
39 # back to the worker
40 cd -
41 
42 # copy job dir here
43 cp -r $PBS_O_WORKDIR .
44 
45 # go inside
46 jobdir=`ls`
47 echo $jobdir
48 
49 cd $jobdir
50 
51 cat > sysinfo.sh <<EOF
52 #! env bash
53 echo '************** ENVIRONMENT ****************'
54 
55 env
56 
57 echo
58 echo '************** WORKER *********************'
59 echo
60 
61 free
62 cat /proc/cpuinfo
63 
64 echo
65 echo '************** START *********************'
66 echo
67 EOF
68 
69 source sysinfo.sh > sysinfo.txt
70 
71 cmsRun run_cfg.py
72 
73 # copy job dir do disk
74 cd -
75 cp -r $jobdir $PBS_O_WORKDIR
76 """
77  return script
78 
79 
80 
def batchScriptCCIN2P3()
Definition: cmsBatch.py:19

◆ batchScriptCERN()

def cmsBatch.batchScriptCERN (   remoteDir,
  index 
)
prepare the LSF version of the batch script, to run on LSF

Definition at line 94 of file cmsBatch.py.

References rootfiles_to_eos_script().

Referenced by cmsBatch.MyBatchManager.PrepareJobUser().

94 def batchScriptCERN( remoteDir, index ):
95  '''prepare the LSF version of the batch script, to run on LSF'''
96  script = """#!/bin/bash
97 # sets the queue
98 #BSUB -q 8nm
99 
100 echo 'environment:'
101 echo
102 env
103 ulimit -v 3000000
104 echo 'copying job dir to worker'
105 cd $CMSSW_BASE/src
106 eval `scramv1 ru -sh`
107 cd -
108 cp -rf $LS_SUBCWD .
109 ls
110 cd `find . -type d | grep /`
111 echo 'running'
112 {prog} run_cfg.py
113 if [ $? != 0 ]; then
114  echo wrong exit code! removing all root files
115  rm *.root
116  exit 1
117 fi
118 echo 'sending the job directory back'
119 """.format(prog=prog)
120 
121  if remoteDir != '':
122  script += rootfiles_to_eos_script(index, remoteDir)
123 
124  script += 'cp -rf * $LS_SUBCWD\n'
125 
126  return script
127 
def rootfiles_to_eos_script(index, remoteDir)
Definition: cmsBatch.py:81
def batchScriptCERN(remoteDir, index)
Definition: cmsBatch.py:94

◆ batchScriptLocal()

def cmsBatch.batchScriptLocal (   remoteDir,
  index 
)
prepare a local version of the batch script, to run using nohup

Definition at line 128 of file cmsBatch.py.

References rootfiles_to_eos_script().

Referenced by cmsBatch.MyBatchManager.PrepareJobUser().

128 def batchScriptLocal( remoteDir, index ):
129  '''prepare a local version of the batch script, to run using nohup'''
130 
131  script = """#!/bin/bash
132 echo 'running'
133 {prog} run_cfg.py
134 if [ $? != 0 ]; then
135  echo wrong exit code! removing all root files
136  rm *.root
137  exit 1
138 fi
139 echo 'sending the job directory back'
140 """.format(prog=prog)
141 
142  if remoteDir != '':
143  script += rootfiles_to_eos_script(index, remoteDir)
144 
145  return script
146 
147 
def rootfiles_to_eos_script(index, remoteDir)
Definition: cmsBatch.py:81
def batchScriptLocal(remoteDir, index)
Definition: cmsBatch.py:128

◆ rootfiles_to_eos_script()

def cmsBatch.rootfiles_to_eos_script (   index,
  remoteDir 
)

Definition at line 81 of file cmsBatch.py.

References eostools.eosToLFN().

Referenced by batchScriptCERN(), and batchScriptLocal().

81 def rootfiles_to_eos_script(index, remoteDir):
82  remoteDir = eostools.eosToLFN(remoteDir)
83  return """
84 for file in *.root; do
85 newFileName=`echo $file | sed -r -e 's/\./_{index}\./'`
86 fullFileName={remoteDir}/$newFileName
87 {eos} cp $file /eos/cms/$fullFileName
88 {eos} chmod 755 /eos/cms/$fullFileName
89 rm *.root
90 done
91 """.format(index=index, remoteDir=remoteDir, eos=eostools.eos_select)
92 
93 
def rootfiles_to_eos_script(index, remoteDir)
Definition: cmsBatch.py:81
def eosToLFN(path)
Definition: eostools.py:66

Variable Documentation

◆ action

cmsBatch.action

Definition at line 250 of file cmsBatch.py.

◆ args

cmsBatch.args

Definition at line 253 of file cmsBatch.py.

◆ argv

cmsBatch.argv

◆ batchManager

cmsBatch.batchManager

Definition at line 200 of file cmsBatch.py.

◆ cfgFile

cmsBatch.cfgFile

Definition at line 321 of file cmsBatch.py.

◆ cfgFileName

cmsBatch.cfgFileName

Definition at line 273 of file cmsBatch.py.

◆ cfo

cmsBatch.cfo

Definition at line 287 of file cmsBatch.py.

◆ default

cmsBatch.default

Definition at line 242 of file cmsBatch.py.

◆ dest

cmsBatch.dest

batchManager.parser_.add_option("-b", "--batch", dest="batch", help="batch command. default is: 'bsub -q 8nh < batchScript.sh'. You can also use 'nohup < ./batchScript.sh &' to run locally.", default="bsub -q 8nh < .batchScript.sh")

Definition at line 240 of file cmsBatch.py.

◆ doCVSTag

cmsBatch.doCVSTag

Definition at line 257 of file cmsBatch.py.

◆ file

cmsBatch.file

Definition at line 203 of file cmsBatch.py.

◆ fullSource

cmsBatch.fullSource

Definition at line 296 of file cmsBatch.py.

◆ generator

cmsBatch.generator

Definition at line 297 of file cmsBatch.py.

◆ grouping

cmsBatch.grouping

Definition at line 271 of file cmsBatch.py.

◆ handle

cmsBatch.handle

Definition at line 286 of file cmsBatch.py.

◆ help

cmsBatch.help

Definition at line 241 of file cmsBatch.py.

◆ listOfValues

cmsBatch.listOfValues

Definition at line 304 of file cmsBatch.py.

◆ log

cmsBatch.log

Definition at line 343 of file cmsBatch.py.

◆ logDir

cmsBatch.logDir

Definition at line 341 of file cmsBatch.py.

◆ nFiles

cmsBatch.nFiles

◆ nJobs

cmsBatch.nJobs

Definition at line 272 of file cmsBatch.py.

◆ oldPwd

cmsBatch.oldPwd

Definition at line 339 of file cmsBatch.py.

◆ options

cmsBatch.options

Definition at line 253 of file cmsBatch.py.

◆ process

cmsBatch.process

Definition at line 288 of file cmsBatch.py.

◆ prog

cmsBatch.prog

Definition at line 256 of file cmsBatch.py.

◆ pycfg_params

cmsBatch.pycfg_params

Definition at line 277 of file cmsBatch.py.

◆ runningMode

cmsBatch.runningMode

Definition at line 264 of file cmsBatch.py.

◆ True

cmsBatch.True

Definition at line 250 of file cmsBatch.py.

◆ trueArgv

cmsBatch.trueArgv

Definition at line 278 of file cmsBatch.py.

◆ usage

cmsBatch.usage

Definition at line 207 of file cmsBatch.py.

◆ waitingTime

cmsBatch.waitingTime

Definition at line 327 of file cmsBatch.py.