CMS 3D CMS Logo

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

Public Member Functions

def PrepareJobUser (self, jobDir, value)
 

Detailed Description

Batch manager specific to cmsRun processes.

Definition at line 297 of file heppy_batch.py.

Member Function Documentation

◆ PrepareJobUser()

def heppy_batch.MyBatchManager.PrepareJobUser (   self,
  jobDir,
  value 
)
Prepare one job. This function is called by the base class.

Definition at line 300 of file heppy_batch.py.

References heppy_batch.batchScriptCERN(), heppy_batch.batchScriptIC(), heppy_batch.batchScriptLocal(), heppy_batch.batchScriptPADOVA(), heppy_batch.batchScriptPISA(), print(), batchmanager.BatchManager.remoteOutputDir_, python.rootplot.root2matplotlib.replace(), and batchmanager.BatchManager.RunningMode().

300  def PrepareJobUser(self, jobDir, value ):
301  '''Prepare one job. This function is called by the base class.'''
302  print(value)
303  print(components[value])
304 
305  #prepare the batch script
306  scriptFileName = jobDir+'/batchScript.sh'
307  scriptFile = open(scriptFileName,'w')
308  storeDir = self.remoteOutputDir_.replace('/castor/cern.ch/cms','')
309  mode = self.RunningMode(options.batch)
310  if mode == 'LXPLUS':
311  scriptFile.write( batchScriptCERN( jobDir, storeDir ) )
312  elif mode == 'PSI':
313  scriptFile.write( batchScriptPSI ( value, jobDir, storeDir ) ) # storeDir not implemented at the moment
314  elif mode == 'LOCAL':
315  scriptFile.write( batchScriptLocal( storeDir, value) ) # watch out arguments are swapped (although not used)
316  elif mode == 'PISA' :
317  scriptFile.write( batchScriptPISA( storeDir, value) )
318  elif mode == 'PADOVA' :
319  scriptFile.write( batchScriptPADOVA( value, jobDir) )
320  elif mode == 'IC':
321  scriptFile.write( batchScriptIC(jobDir) )
322  scriptFile.close()
323  os.system('chmod +x %s' % scriptFileName)
324 
325  shutil.copyfile(cfgFileName, jobDir+'/pycfg.py')
326 # jobConfig = copy.deepcopy(config)
327 # jobConfig.components = [ components[value] ]
328  cfgFile = open(jobDir+'/config.pck','w')
329  pickle.dump( components[value] , cfgFile )
330  # pickle.dump( cfo, cfgFile )
331  cfgFile.close()
332  if hasattr(self,"heppyOptions_"):
333  optjsonfile = open(jobDir+'/options.json','w')
334  optjsonfile.write(json.dumps(self.heppyOptions_))
335  optjsonfile.close()
336 
def batchScriptPADOVA(index, jobDir='./')
Definition: heppy_batch.py:17
def batchScriptIC(jobDir)
Definition: heppy_batch.py:264
def replace(string, replacements)
def batchScriptPISA(index, remoteDir='')
Definition: heppy_batch.py:46
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def batchScriptLocal(remoteDir, index)
Definition: heppy_batch.py:284
def batchScriptCERN(jobDir, remoteDir='')
Definition: heppy_batch.py:78