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

◆ PrepareJobUser()

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.

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 

References cmsBatch.batchScriptCERN(), cmsBatch.batchScriptLocal(), edm.print(), batchmanager.BatchManager.remoteOutputDir_, python.rootplot.root2matplotlib.replace(), and batchmanager.BatchManager.RunningMode().

Referenced by batchmanager.BatchManager.PrepareJob().

edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
cmsBatch.batchScriptLocal
def batchScriptLocal(remoteDir, index)
Definition: cmsBatch.py:128
cmsBatch.batchScriptCERN
def batchScriptCERN(remoteDir, index)
Definition: cmsBatch.py:94
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444