CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 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(), print(), and batchmanager.BatchManager.RunningMode().

Referenced by batchmanager.BatchManager.PrepareJob().

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