CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions
validateAlignments.ValidationJobMultiIOV Class Reference
Inheritance diagram for validateAlignments.ValidationJobMultiIOV:
validateAlignments.ValidationBase

Public Member Functions

def __init__ (self, validation, config, options, outPath, args, kwargs)
 
def __iter__ (self)
 
def __next__ (self)
 
def createJob (self)
 
def getValidation (self)
 
def needsproxy (self)
 
def runJob (self)
 
- Public Member Functions inherited from validateAlignments.ValidationBase
def __init__ (self, validation, config, options)
 
def createJob (self)
 
def getValidation (self)
 
def needsproxy (self)
 
def runJob (self)
 

Static Public Member Functions

def runCondorJobs (outdir)
 

Public Attributes

 config
 
 end
 
 optionMultiIOV
 
 options
 
 outPath
 
 start
 
 validation
 
 validations
 
 valSection
 
 valType
 
- Public Attributes inherited from validateAlignments.ValidationBase
 alignments
 
 commandLineOptions
 
 config
 
 preexisting
 
 valName
 
 valSection
 
 valType
 

Private Member Functions

def __performMultiIOV (self, validation, alignments, config, options, outPath)
 

Detailed Description

Definition at line 288 of file validateAlignments.py.

Constructor & Destructor Documentation

def validateAlignments.ValidationJobMultiIOV.__init__ (   self,
  validation,
  config,
  options,
  outPath,
  args,
  kwargs 
)

Definition at line 290 of file validateAlignments.py.

290  def __init__( self, validation, config, options, outPath, *args, **kwargs):
291  self.start = 0
292  self.end = args
293  super(ValidationJobMultiIOV, self).__init__( validation, config, options )
294  self.optionMultiIOV = self.config.getboolean( self.valSection, "multiIOV" )
295  if self.optionMultiIOV == True:
296  self.validation = validation
297  self.config = config
298  self.options = options
299  self.outPath = outPath
301  self.options, self.outPath)
302 
303 
def __init__(self, validation, config, options, outPath, args, kwargs)
def __performMultiIOV(self, validation, alignments, config, options, outPath)

Member Function Documentation

def validateAlignments.ValidationJobMultiIOV.__iter__ (   self)

Definition at line 467 of file validateAlignments.py.

467  def __iter__(self):
468  yield self
469 
def validateAlignments.ValidationJobMultiIOV.__next__ (   self)
def validateAlignments.ValidationJobMultiIOV.__performMultiIOV (   self,
  validation,
  alignments,
  config,
  options,
  outPath 
)
private

Definition at line 304 of file validateAlignments.py.

304  def __performMultiIOV(self, validation, alignments, config, options, outPath):
305  validations = []
306  if self.valType == "compare":
307  alignmentsList = alignments.split( "," )
308  firstAlignList = alignmentsList[0].split()
309  firstAlignName = firstAlignList[0].strip()
310  secondAlignList = alignmentsList[1].split()
311  secondAlignName = secondAlignList[0].strip()
312  compareAlignments = "%s"%firstAlignName + "_vs_%s"%secondAlignName
313  sectionMultiIOV = "multiIOV:compare"
314  if not self.config.has_section(sectionMultiIOV):
315  raise AllInOneError("section'[%s]' not found. Please define the dataset"%sectionMultiIOV)
316  iovList = self.config.get( sectionMultiIOV, "iovs" )
317  iovList = re.sub(r"\s+", "", iovList, flags=re.UNICODE).split( "," )
318  for iov in iovList:
319  tmpConfig = BetterConfigParser()
320  tmpConfig.read( options.config )
321  general = tmpConfig.getGeneral()
322  tmpConfig.add_section("IOV")
323  tmpConfig.set("IOV", "iov", iov)
324  tmpConfig.set("internals","workdir",os.path.join(general["workdir"], options.Name, self.valType + "_%s"%compareAlignments + "_%s"%iov) )
325  tmpConfig.set("internals","scriptsdir",os.path.join(outPath, self.valType + "_%s"%compareAlignments + "_%s"%iov) )
326  tmpConfig.set("general","datadir",os.path.join(general["datadir"], options.Name, self.valType + "_%s"%compareAlignments + "_%s"%iov) )
327  tmpConfig.set("general","logdir",os.path.join(general["logdir"], options.Name, self.valType + "_%s"%compareAlignments + "_%s"%iov) )
328  tmpConfig.set("general","eosdir",os.path.join("AlignmentValidation", general["eosdir"], options.Name, self.valType + "_%s"%compareAlignments + "_%s"%iov) )
329  tmpOptions = copy.deepcopy(options)
330  tmpOptions.Name = os.path.join(options.Name, self.valType + "_%s"%compareAlignments + "_%s"%iov)
331  tmpOptions.config = tmpConfig
332  newOutPath = os.path.abspath( tmpOptions.Name )
333  if not os.path.exists( newOutPath ):
334  os.makedirs( newOutPath )
335  elif not os.path.isdir( newOutPath ):
336  raise AllInOneError("the file %s is in the way rename the Job or move it away"%newOutPath)
337  job = ValidationJob( validation, tmpConfig, tmpOptions, len(iovList) )
338  validations.append(job)
339 
340  return validations
341 
342  if "preexisting" in self.valType:
343  preexistingValType = self.valType
344  preexistingValSection = self.valSection
345  preexistingEosdir = self.config.get( self.valSection, "eosdirName" )
346  originalValType = preexistingValType.replace('preexisting', '')
347  originalValName = self.config.get( self.valSection, "originalValName" )
348  self.valSection = originalValType + ":" + originalValName
349  originalAlignment = self.valName
350 
351  datasetList = self.config.get( self.valSection, "dataset" )
352  datasetList = re.sub(r"\s+", "", datasetList, flags=re.UNICODE).split( "," )
353  for dataset in datasetList:
354  sectionMultiIOV = "multiIOV:%s"%dataset
355  if not self.config.has_section(sectionMultiIOV):
356  raise AllInOneError("section'[%s]' not found. Please define the dataset"%sectionMultiIOV)
357  else:
358  datasetBaseName = self.config.get( sectionMultiIOV, "dataset" )
359  iovList = self.config.get( sectionMultiIOV, "iovs" )
360  iovList = re.sub(r"\s+", "", iovList, flags=re.UNICODE).split( "," )
361  for iov in iovList:
362  datasetName = datasetBaseName+"_since%s"%iov
363  tmpConfig = BetterConfigParser()
364  tmpConfig.read( options.config )
365  general = tmpConfig.getGeneral()
366  if "preexisting" in self.valType:
367  valType = originalValType
368  valName = originalValName
369  else:
370  valType = self.valType
371  valName = self.valName
372  tmpConfig.add_section("IOV")
373  tmpConfig.set("IOV", "iov", iov)
374  tmpConfig.set( self.valSection, "dataset", datasetName )
375  tmpConfig.set("internals","workdir",os.path.join(general["workdir"], options.Name, valType + "_" + valName + "_%s"%iov) )
376  tmpConfig.set("internals","scriptsdir",os.path.join(outPath, valType + "_" + valName + "_%s"%iov) )
377  tmpConfig.set("general","datadir",os.path.join(general["datadir"], options.Name, valType + "_" + valName + "_%s"%iov) )
378  tmpConfig.set("general","logdir",os.path.join(general["logdir"], options.Name, valType + "_" + valName + "_%s"%iov) )
379  tmpConfig.set("general","eosdir",os.path.join("AlignmentValidation", general["eosdir"], options.Name, valType + "_" + valName + "_%s"%iov) )
380  if "preexisting" in self.valType:
381  if self.valType == "preexistingoffline":
382  validationClassName = "AlignmentValidation"
383  #elif self.valType == "preexistingmcValidate":
384  # validationClassName = "MonteCarloValidation"
385  #elif self.valType == "preexistingsplit":
386  # validationClassName = "TrackSplittingValidation"
387  #elif self.valType == "preexistingprimaryvertex":
388  # validationClassName = "PrimaryVertexValidation"
389  else:
390  raise AllInOneError("Unknown validation mode for preexisting option:'%s'"%self.valType)
391  preexistingEosdirPath = os.path.join("AlignmentValidation", preexistingEosdir, valType + "_" + valName + "_%s"%iov)
392  file = "/eos/cms/store/group/alca_trackeralign/AlignmentValidation/" + "%s"%preexistingEosdirPath + "/%s"%validationClassName + "_%s"%originalValName + "_%s"%originalAlignment + ".root"
393  tmpConfig.set(preexistingValSection, "file", file)
394  tmpOptions = copy.deepcopy(options)
395  tmpOptions.Name = os.path.join(options.Name, valType + "_" + valName + "_%s"%iov)
396  tmpOptions.config = tmpConfig
397  newOutPath = os.path.abspath( tmpOptions.Name )
398  if not os.path.exists( newOutPath ):
399  os.makedirs( newOutPath )
400  elif not os.path.isdir( newOutPath ):
401  raise AllInOneError("the file %s is in the way rename the Job or move it away"%newOutPath)
402  job = ValidationJob( validation, tmpConfig, tmpOptions, len(iovList) )
403  validations.append(job)
404 
405  return validations
406 
def __performMultiIOV(self, validation, alignments, config, options, outPath)
double split
Definition: MVATrainer.cc:139
def validateAlignments.ValidationJobMultiIOV.createJob (   self)
def validateAlignments.ValidationJobMultiIOV.getValidation (   self)

Definition at line 461 of file validateAlignments.py.

References validateAlignments.ValidationJobMultiIOV.validations.

461  def getValidation( self ):
462  return [validation.getValidation() for validation in self.validations]
463 
def validateAlignments.ValidationJobMultiIOV.needsproxy (   self)

Definition at line 464 of file validateAlignments.py.

References join(), validateAlignments.ValidationBase.preexisting, and validateAlignments.ValidationJobMultiIOV.validations.

464  def needsproxy( self ):
465  return [validation.needsproxy() for validation in self.validations].join("and") and not self.preexisting and not self.commandLineOptions.dryRun
466 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def validateAlignments.ValidationJobMultiIOV.runCondorJobs (   outdir)
static

Definition at line 414 of file validateAlignments.py.

References mps_setup.append, join(), and split.

414  def runCondorJobs(outdir):
415  dagmanLog = "{}/daglogs".format(outdir)
416  os.system("mkdir -p {}".format(dagmanLog))
417 
418 
419  with open("{}/validation.condor".format(outdir), "w") as condor:
420  condor.write("universe = vanilla" + "\n")
421  condor.write("executable = $(scriptName).sh" + "\n")
422  condor.write("log = $(scriptName).log" + "\n")
423  condor.write("error = $(scriptName).stderr" + "\n")
424  condor.write("output = $(scriptName).stdout" + "\n")
425  condor.write('requirements = (OpSysAndVer =?= "CentOS7")' + '\n')
426  condor.write('+JobFlavour = "tomorrow"' + "\n")
427  condor.write('+RequestMemory = {}'.format(1540) + "\n")
428  condor.write('+FileTransferDownloadBytes = {}'.format(1540) + "\n")
429  condor.write('+AccountingGroup = "group_u_CMS.CAF.ALCA"' + '\n')
430  condor.write("queue")
431 
432  with open("{}/validation.dagman".format(outdir), "w") as dagman:
433  parents = {}
434  for (valType, valName, iov), alignments in six.iteritems(ValidationJob.condorConf):
435 
436  parents[(valType, valName, iov)] = []
437  for jobInfo in alignments:
438  if not "preexisting" in jobInfo[0]:
439  dagman.write("JOB {}_{} {}/validation.condor".format(jobInfo[0], iov, outdir) + "\n")
440  dagman.write('VARS {}_{} '.format(jobInfo[0], iov) + 'scriptName="{}"'.format('.'.join(jobInfo[1].split('.')[:-1])) + "\n")
441  parents[(valType, valName, iov)].append('{}_{}'.format(jobInfo[0], iov))
442  dagman.write("\n")
443 
444  path = os.path.join(jobInfo[2], "TkAlMerge.sh")
445  if os.path.exists( path ):
446  dagman.write("JOB Merge_{}_{}_{} {}/validation.condor".format(valType, valName, iov, outdir) + "\n")
447  dagman.write("VARS Merge_{}_{}_{} ".format(valType, valName, iov) + 'scriptName="{}"'.format(os.path.join(jobInfo[2], "TkAlMerge")) + "\n")
448  dagman.write("\n")
449  else:
450  raise AllInOneError("Merge script '[%s]' not found!"%path)
451 
452  for (valType, valName, iov), alignments in six.iteritems(ValidationJob.condorConf):
453  if len(parents[(valType, valName, iov)]) != 0:
454  dagman.write('PARENT {} '.format(" ".join([parent for parent in parents[(valType, valName, iov)]])) + 'CHILD Merge_{}_{}_{}'.format(valType, valName, iov) + "\n")
455 
456  submitCommands = ["condor_submit_dag -no_submit -outfile_dir {} {}/validation.dagman".format(dagmanLog, outdir), "condor_submit {}/validation.dagman.condor.sub".format(outdir)]
457 
458  for command in submitCommands:
459  subprocess.call(command.split(" "))
460 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
def validateAlignments.ValidationJobMultiIOV.runJob (   self)

Definition at line 410 of file validateAlignments.py.

References validateAlignments.ValidationJobMultiIOV.validations.

410  def runJob( self ):
411  return [validation.runJob() for validation in self.validations]
412 

Member Data Documentation

validateAlignments.ValidationJobMultiIOV.config

Definition at line 297 of file validateAlignments.py.

validateAlignments.ValidationJobMultiIOV.end
validateAlignments.ValidationJobMultiIOV.optionMultiIOV

Definition at line 294 of file validateAlignments.py.

validateAlignments.ValidationJobMultiIOV.options

Definition at line 298 of file validateAlignments.py.

Referenced by DOTExport.DotProducer.__call__(), betterConfigParser.BetterConfigParser.__updateDict(), DTWorkflow.DTWorkflow.add_local_custom_db(), confdb.HLTProcess.buildOptions(), DTWorkflow.DTWorkflow.check_missing_options(), betterConfigParser.BetterConfigParser.checkInput(), DOTExport.DotProducer.connectTags(), CrabHelper.CrabHelper.crab_config_filename(), CrabHelper.CrabHelper.crab_taskname(), DTWorkflow.DTWorkflow.dump_options(), DOTExport.DotExport.export(), CrabHelper.CrabHelper.fill_options_from_crab_config(), confdb.HLTProcess.fixPrescales(), confdb.HLTProcess.getRawConfigurationFromDB(), confdb.HLTProcess.getSetupConfigurationFromDB(), DOTExport.DotProducer.getTopLevel(), DTWorkflow.DTWorkflow.load_options(), DOTExport.DotProducer.makePath(), DOTExport.DotProducer.nodeLabel(), DOTExport.DotProducer.nodeURL(), DTWorkflow.DTWorkflow.prepare_common_submit(), DOTExport.DotProducer.produceLegend(), DOTExport.DotProducer.produceNodes(), DOTExport.DotProducer.producePaths(), DOTExport.DotProducer.produceServices(), DOTExport.DotProducer.produceSource(), edmIntegrityCheck.IntegrityCheck.query(), DTCalibrationWorker.DTCalibrationWorker.run(), cmsswPreprocessor.CmsswPreprocessor.run(), DTWorkflow.DTWorkflow.run(), production_tasks.BaseDataset.run(), production_tasks.GenerateMask.run(), production_tasks.RunCMSBatch.run(), production_tasks.MonitorJobs.run(), production_tasks.CheckJobStatus.run(), production_tasks.CleanJobFiles.run(), DOTExport.DotProducer.seqRecurseChildren(), FileExportPlugin.FileExportPlugin.setOption(), DTWorkflow.DTWorkflow.user(), and DOTExport.DotExport.write_output().

validateAlignments.ValidationJobMultiIOV.outPath

Definition at line 299 of file validateAlignments.py.

validateAlignments.ValidationJobMultiIOV.start
validateAlignments.ValidationJobMultiIOV.validation

Definition at line 296 of file validateAlignments.py.

validateAlignments.ValidationJobMultiIOV.validations
validateAlignments.ValidationJobMultiIOV.valSection

Definition at line 348 of file validateAlignments.py.

validateAlignments.ValidationJobMultiIOV.valType