CMS 3D CMS Logo

List of all members | Public Member Functions
cmsBatch.MyBatchManager Class Reference
Inheritance diagram for cmsBatch.MyBatchManager:

Public Member Functions

def PrepareJobUser (self, jobDir, value)
 

Detailed Description

Batch manager specific to cmsRun processes.

Definition at line 158 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 161 of file cmsBatch.py.

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

Referenced by batchmanager.BatchManager.PrepareJob().

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