CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
cmsBatch.MyBatchManager Class Reference
Inheritance diagram for cmsBatch.MyBatchManager:

Public Member Functions

def PrepareJobUser
 

Detailed Description

Batch manager specific to cmsRun processes.

Definition at line 162 of file cmsBatch.py.

Member Function Documentation

def cmsBatch.MyBatchManager.PrepareJobUser (   self,
  jobDir,
  value 
)
Prepare one job. This function is called by the base class.

Definition at line 165 of file cmsBatch.py.

References cmsBatch.batchScriptCERN(), cmsBatch.batchScriptLocal(), and batchmanager.BatchManager.RunningMode().

Referenced by batchmanager.BatchManager.PrepareJob().

166  def PrepareJobUser(self, jobDir, value ):
167  '''Prepare one job. This function is called by the base class.'''
168 
169  process.source = fullSource.clone()
170 
171  #prepare the batch script
172  scriptFileName = jobDir+'/batchScript.sh'
173  scriptFile = open(scriptFileName,'w')
174  storeDir = self.remoteOutputDir_.replace('/castor/cern.ch/cms','')
175  mode = self.RunningMode(options.batch)
176  if mode == 'LXPLUS':
177  scriptFile.write( batchScriptCERN( storeDir, value) ) #here is the call to batchScriptCERN, i need to change value
178  elif mode == 'LOCAL':
179  scriptFile.write( batchScriptLocal( storeDir, value) ) #same as above but for batchScriptLocal
180  scriptFile.close()
181  os.system('chmod +x %s' % scriptFileName)
182 
183  #prepare the cfg
184  # replace the list of fileNames by a chunk of filenames:
185  if generator:
186  randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService)
187  randSvc.populate()
188  else:
189  iFileMin = (value-1)*grouping
190  iFileMax = (value)*grouping
191  process.source.fileNames = fullSource.fileNames[iFileMin:iFileMax]
192  print process.source
193  cfgFile = open(jobDir+'/run_cfg.py','w')
194  cfgFile.write('import FWCore.ParameterSet.Config as cms\n\n')
195  cfgFile.write('import os,sys\n')
196  # need to import most of the config from the base directory containing all jobs
197  cfgFile.write("sys.path.append('%s')\n" % os.path.dirname(jobDir) )
198  cfgFile.write('from base_cfg import *\n')
199  cfgFile.write('process.source = ' + process.source.dumpPython() + '\n')
200  if generator:
201  cfgFile.write('process.RandomNumberGeneratorService = ' + process.RandomNumberGeneratorService.dumpPython() + '\n')
202  cfgFile.close()
203 
def batchScriptLocal
Definition: cmsBatch.py:125
def batchScriptCERN
Definition: cmsBatch.py:80