CMS 3D CMS Logo

List of all members | Public Member Functions
production_tasks.RunCMSBatch Class Reference
Inheritance diagram for production_tasks.RunCMSBatch:
production_tasks.Task

Public Member Functions

def __init__ (self, dataset, user, options)
 
def addOption (self, parser)
 
def run (self, input)
 
- Public Member Functions inherited from production_tasks.Task
def __init__ (self, name, dataset, user, options, instance=None)
 
def addOption (self, parser)
 
def getname (self)
 
def run (self, input)
 

Additional Inherited Members

- Public Attributes inherited from production_tasks.Task
 dataset
 
 instance
 
 name
 
 options
 
 user
 

Detailed Description

Run the 'cmsBatch.py' command on your CFG, submitting to the CERN batch system

Definition at line 524 of file production_tasks.py.

Constructor & Destructor Documentation

def production_tasks.RunCMSBatch.__init__ (   self,
  dataset,
  user,
  options 
)

Definition at line 527 of file production_tasks.py.

527  def __init__(self, dataset, user, options):
528  Task.__init__(self,'RunCMSBatch', dataset, user, options)
def __init__(self, dataset, user, options)

Member Function Documentation

def production_tasks.RunCMSBatch.addOption (   self,
  parser 
)

Definition at line 529 of file production_tasks.py.

529  def addOption(self, parser):
530  parser.add_option("--batch_user", dest="batch_user", help="The user for LSF", default=os.getlogin())
531  parser.add_option("--run_batch", dest="run_batch", default=True, action='store_true',help='Run on the batch system')
532  parser.add_option("-N", "--numberOfInputFiles", dest="nInput",help="Number of input files per job",default=5,type=int)
533  parser.add_option("-q", "--queue", dest="queue", help="The LSF queue to use", default="1nh")
534  parser.add_option("-t", "--tier", dest="tier",
535  help="Tier: extension you can give to specify you are doing a new production. If you give a Tier, your new files will appear in sampleName/tierName, which will constitute a new dataset.",
536  default="")
537  parser.add_option("-G", "--group", dest="group", help="The LSF user group to use, e.g. 'u_zh'", default=None)
538 
def production_tasks.RunCMSBatch.run (   self,
  input 
)

Definition at line 539 of file production_tasks.py.

References production_tasks.Task.dataset, edmIntegrityCheck.IntegrityCheck.dataset, genericValidation.GenericValidationData.dataset, join(), FileExportPlugin.FileExportPlugin.options, cmsswPreprocessor.CmsswPreprocessor.options, DTCalibrationWorker.DTCalibrationWorker.options, DTWorkflow.DTWorkflow.options, TestProcess.TestProcess.options, DOTExport.DotProducer.options, confdb.HLTProcess.options, production_tasks.Task.options, edmIntegrityCheck.IntegrityCheck.options, validateAlignments.ValidationJobMultiIOV.options, edm.print(), and str.

539  def run(self, input):
540  find = FindOnCastor(self.dataset,self.options.batch_user,self.options)
541  find.create = True
542  out = find.run({})
543 
544  full = input['ExpandConfig']['ExpandedFullCFG']
545  jobdir = input['CreateJobDirectory']['JobDir']
546 
547  sampleDir = os.path.join(out['Directory'],self.options.tier)
548  sampleDir = castortools.castorToLFN(sampleDir)
549 
550  cmd = ['cmsBatch.py',str(self.options.nInput),os.path.basename(full),'-o','%s_Jobs' % self.options.tier,'--force']
551  cmd.extend(['-r',sampleDir])
552  if self.options.run_batch:
553  jname = "%s/%s" % (self.dataset,self.options.tier)
554  jname = jname.replace("//","/")
555  user_group = ''
556  if self.options.group is not None:
557  user_group = '-G %s' % self.options.group
558  cmd.extend(['-b',"'bsub -q %s -J %s -u cmgtoolslsf@gmail.com %s < ./batchScript.sh | tee job_id.txt'" % (self.options.queue,jname,user_group)])
559  print(" ".join(cmd))
560 
561  pwd = os.getcwd()
562 
563  error = None
564  try:
565  os.chdir(jobdir)
566  returncode = os.system(" ".join(cmd))
567 
568  if returncode != 0:
569  error = "Running cmsBatch failed. Return code was %i." % returncode
570  finally:
571  os.chdir(pwd)
572 
573  if error is not None:
574  raise Exception(error)
575 
576  return {'SampleDataset':"%s/%s" % (self.dataset,self.options.tier),'BatchUser':self.options.batch_user,
577  'SampleOutputDir':sampleDir,'LSFJobsTopDir':os.path.join(jobdir,'%s_Jobs' % self.options.tier)}
578 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
#define str(s)