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 156 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 159 of file cmsBatch.py.

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

Referenced by batchmanager.BatchManager.PrepareJob().

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