CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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__
 
def addOption
 
def run
 
- Public Member Functions inherited from production_tasks.Task
def __init__
 
def addOption
 
def getname
 
def run
 

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 520 of file production_tasks.py.

Constructor & Destructor Documentation

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

Definition at line 523 of file production_tasks.py.

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

Member Function Documentation

def production_tasks.RunCMSBatch.addOption (   self,
  parser 
)

Definition at line 525 of file production_tasks.py.

526  def addOption(self, parser):
527  parser.add_option("--batch_user", dest="batch_user", help="The user for LSF", default=os.getlogin())
528  parser.add_option("--run_batch", dest="run_batch", default=True, action='store_true',help='Run on the batch system')
529  parser.add_option("-N", "--numberOfInputFiles", dest="nInput",help="Number of input files per job",default=5,type=int)
530  parser.add_option("-q", "--queue", dest="queue", help="The LSF queue to use", default="1nh")
531  parser.add_option("-t", "--tier", dest="tier",
532  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.",
533  default="")
534  parser.add_option("-G", "--group", dest="group", help="The LSF user group to use, e.g. 'u_zh'", default=None)
def production_tasks.RunCMSBatch.run (   self,
  input 
)

Definition at line 535 of file production_tasks.py.

References CalibratedPatElectronProducer.dataset, production_tasks.Task.dataset, CalibratedElectronProducer.dataset, edmIntegrityCheck.IntegrityCheck.dataset, genericValidation.GenericValidationData.dataset, join(), FileExportPlugin.FileExportPlugin.options, cmsswPreprocessor.CmsswPreprocessor.options, DOTExport.DotProducer.options, confdb.HLTProcess.options, production_tasks.Task.options, and edmIntegrityCheck.IntegrityCheck.options.

536  def run(self, input):
537  find = FindOnCastor(self.dataset,self.options.batch_user,self.options)
538  find.create = True
539  out = find.run({})
540 
541  full = input['ExpandConfig']['ExpandedFullCFG']
542  jobdir = input['CreateJobDirectory']['JobDir']
543 
544  sampleDir = os.path.join(out['Directory'],self.options.tier)
545  sampleDir = castortools.castorToLFN(sampleDir)
546 
547  cmd = ['cmsBatch.py',str(self.options.nInput),os.path.basename(full),'-o','%s_Jobs' % self.options.tier,'--force']
548  cmd.extend(['-r',sampleDir])
549  if self.options.run_batch:
550  jname = "%s/%s" % (self.dataset,self.options.tier)
551  jname = jname.replace("//","/")
552  user_group = ''
553  if self.options.group is not None:
554  user_group = '-G %s' % self.options.group
555  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)])
556  print " ".join(cmd)
557 
558  pwd = os.getcwd()
559 
560  error = None
561  try:
562  os.chdir(jobdir)
563  returncode = os.system(" ".join(cmd))
564 
565  if returncode != 0:
566  error = "Running cmsBatch failed. Return code was %i." % returncode
567  finally:
568  os.chdir(pwd)
569 
570  if error is not None:
571  raise Exception(error)
572 
573  return {'SampleDataset':"%s/%s" % (self.dataset,self.options.tier),'BatchUser':self.options.batch_user,
574  'SampleOutputDir':sampleDir,'LSFJobsTopDir':os.path.join(jobdir,'%s_Jobs' % self.options.tier)}
static std::string join(char **cmd)
Definition: RemoteFile.cc:18