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 294 of file validateAlignments.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 296 of file validateAlignments.py.

296  def __init__( self, validation, config, options, outPath, *args, **kwargs):
297  self.start = 0
298  self.end = args
299  super(ValidationJobMultiIOV, self).__init__( validation, config, options )
300  self.optionMultiIOV = self.config.getboolean( self.valSection, "multiIOV" )
301  if self.optionMultiIOV == True:
302  self.validation = validation
303  self.config = config
304  self.options = options
305  self.outPath = outPath
306  self.validations = self.__performMultiIOV(self.validation, self.alignments, self.config,
307  self.options, self.outPath)
308 
309 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ __iter__()

def validateAlignments.ValidationJobMultiIOV.__iter__ (   self)

Definition at line 473 of file validateAlignments.py.

473  def __iter__(self):
474  yield self
475 

◆ __next__()

def validateAlignments.ValidationJobMultiIOV.__next__ (   self)

Definition at line 476 of file validateAlignments.py.

References validateAlignments.ValidationJob.end, validateAlignments.ValidationJobMultiIOV.end, svgfig.LineAxis.end, validateAlignments.ValidationJob.start, validateAlignments.ValidationJobMultiIOV.start, and svgfig.LineAxis.start.

476  def __next__(self):
477  if self.start >= len(self.end):
478  raise StopIteration
479  else:
480  self.start += 1
481  return self.end[self.start-1]
482 
483 

◆ __performMultiIOV()

def validateAlignments.ValidationJobMultiIOV.__performMultiIOV (   self,
  validation,
  alignments,
  config,
  options,
  outPath 
)
private

Definition at line 310 of file validateAlignments.py.

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

◆ createJob()

def validateAlignments.ValidationJobMultiIOV.createJob (   self)

Definition at line 413 of file validateAlignments.py.

References validateAlignments.ValidationJobMultiIOV.validations.

413  def createJob( self ):
414  lmap( lambda validation: validation.createJob(), self.validations )
415 

◆ getValidation()

def validateAlignments.ValidationJobMultiIOV.getValidation (   self)

Definition at line 467 of file validateAlignments.py.

References validateAlignments.ValidationJobMultiIOV.validations.

467  def getValidation( self ):
468  return [validation.getValidation() for validation in self.validations]
469 

◆ needsproxy()

def validateAlignments.ValidationJobMultiIOV.needsproxy (   self)

Definition at line 470 of file validateAlignments.py.

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

470  def needsproxy( self ):
471  return [validation.needsproxy() for validation in self.validations].join("and") and not self.preexisting and not self.commandLineOptions.dryRun
472 
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ runCondorJobs()

def validateAlignments.ValidationJobMultiIOV.runCondorJobs (   outdir)
static

Definition at line 420 of file validateAlignments.py.

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

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

◆ runJob()

def validateAlignments.ValidationJobMultiIOV.runJob (   self)

Definition at line 416 of file validateAlignments.py.

References validateAlignments.ValidationJobMultiIOV.validations.

416  def runJob( self ):
417  return [validation.runJob() for validation in self.validations]
418 

Member Data Documentation

◆ config

validateAlignments.ValidationJobMultiIOV.config

◆ end

validateAlignments.ValidationJobMultiIOV.end

◆ optionMultiIOV

validateAlignments.ValidationJobMultiIOV.optionMultiIOV

Definition at line 300 of file validateAlignments.py.

◆ options

validateAlignments.ValidationJobMultiIOV.options

Definition at line 304 of file validateAlignments.py.

Referenced by betterConfigParser.BetterConfigParser.__updateDict(), submitPVValidationJobs.BetterConfigParser.__updateDict(), DTWorkflow.DTWorkflow.add_local_calib_db(), DTWorkflow.DTWorkflow.add_local_custom_db(), DTWorkflow.DTWorkflow.add_local_t0_db(), DTWorkflow.DTWorkflow.add_local_vdrift_db(), DTWorkflow.DTWorkflow.add_preselection(), DTWorkflow.DTWorkflow.all(), confdb.HLTProcess.buildOptions(), CrabHelper.CrabHelper.check_crabtask(), DTWorkflow.DTWorkflow.check_missing_options(), betterConfigParser.BetterConfigParser.checkInput(), CrabHelper.CrabHelper.crab_config_filename(), CrabHelper.CrabHelper.crab_config_filepath(), CrabHelper.CrabHelper.crab_taskname(), DTWorkflow.DTWorkflow.dump_options(), CrabHelper.CrabHelper.fill_options_from_crab_config(), confdb.HLTProcess.fixPrescales(), DTWorkflow.DTWorkflow.get_config_name(), confdb.HLTProcess.getRawConfigurationFromDB(), confdb.HLTProcess.getSetupConfigurationFromDB(), edmIntegrityCheck.IntegrityCheck.listFiles(), DTWorkflow.DTWorkflow.load_options(), DTWorkflow.DTWorkflow.load_options_command(), DTWorkflow.DTWorkflow.local_path(), production_tasks.MonitorJobs.monitor(), DTWorkflow.DTWorkflow.outpath_workflow_mode_tag(), DTWorkflow.DTWorkflow.prepare_common_submit(), DTWorkflow.DTWorkflow.prepare_common_write(), DTVdriftWorkflow.DTvdriftWorkflow.prepare_meantimer_dump(), DTVdriftWorkflow.DTvdriftWorkflow.prepare_meantimer_submit(), DTVdriftWorkflow.DTvdriftWorkflow.prepare_meantimer_write(), DTTtrigWorkflow.DTttrigWorkflow.prepare_residuals_correction(), DTTtrigWorkflow.DTttrigWorkflow.prepare_residuals_dump(), DTTtrigWorkflow.DTttrigWorkflow.prepare_residuals_submit(), DTVdriftWorkflow.DTvdriftWorkflow.prepare_segment_dump(), DTVdriftWorkflow.DTvdriftWorkflow.prepare_segment_write(), DTTtrigWorkflow.DTttrigWorkflow.prepare_timeboxes_correction(), DTTtrigWorkflow.DTttrigWorkflow.prepare_timeboxes_dump(), DTTtrigWorkflow.DTttrigWorkflow.prepare_validation_submit(), DTTtrigWorkflow.DTttrigWorkflow.prepare_validation_write(), DTT0WireWorkflow.DTT0WireWorkflow.prepare_workflow(), DTVdriftWorkflow.DTvdriftWorkflow.prepare_workflow(), DTTtrigWorkflow.DTttrigWorkflow.prepare_workflow(), edmIntegrityCheck.IntegrityCheck.query(), production_tasks.BaseDataset.query(), DTWorkflow.DTWorkflow.remote_out_path(), edmIntegrityCheck.IntegrityCheck.report(), DTCalibrationWorker.DTCalibrationWorker.run(), cmsswPreprocessor.CmsswPreprocessor.run(), DTWorkflow.DTWorkflow.run(), production_tasks.CheckDatasetExists.run(), production_tasks.BaseDataset.run(), production_tasks.GenerateMask.run(), production_tasks.CreateJobDirectory.run(), production_tasks.SourceCFG.run(), production_tasks.FullCFG.run(), production_tasks.WriteToDatasets.run(), production_tasks.RunCMSBatch.run(), production_tasks.MonitorJobs.run(), production_tasks.CheckJobStatus.run(), production_tasks.WriteJobReport.run(), production_tasks.CleanJobFiles.run(), DTWorkflow.DTWorkflow.runCMSSWtask(), edmIntegrityCheck.IntegrityCheck.structured(), CrabHelper.CrabHelper.submit_crab_task(), DTWorkflow.DTWorkflow.tag(), edmIntegrityCheck.IntegrityCheck.test(), DTWorkflow.DTWorkflow.user(), and CrabHelper.CrabHelper.write_crabConfig().

◆ outPath

validateAlignments.ValidationJobMultiIOV.outPath

Definition at line 305 of file validateAlignments.py.

◆ start

validateAlignments.ValidationJobMultiIOV.start

◆ validation

validateAlignments.ValidationJobMultiIOV.validation

Definition at line 302 of file validateAlignments.py.

◆ validations

validateAlignments.ValidationJobMultiIOV.validations

◆ valSection

validateAlignments.ValidationJobMultiIOV.valSection

Definition at line 354 of file validateAlignments.py.

◆ valType

validateAlignments.ValidationJobMultiIOV.valType