test
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 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().

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