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)
 

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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 297 of file validateAlignments.py.

297  def __init__( self, validation, config, options, outPath, *args, **kwargs):
298  self.start = 0
299  self.end = args
300  super(ValidationJobMultiIOV, self).__init__( validation, config, options )
301  self.optionMultiIOV = self.config.getboolean( self.valSection, "multiIOV" )
302  if self.optionMultiIOV == True:
303  self.validation = validation
304  self.config = config
305  self.options = options
306  self.outPath = outPath
307  self.validations = self.__performMultiIOV(self.validation, self.alignments, self.config,
308  self.options, self.outPath)
309 
310 

Member Function Documentation

◆ __iter__()

def validateAlignments.ValidationJobMultiIOV.__iter__ (   self)

Definition at line 474 of file validateAlignments.py.

474  def __iter__(self):
475  yield self
476 

◆ __next__()

def validateAlignments.ValidationJobMultiIOV.__next__ (   self)

Definition at line 477 of file validateAlignments.py.

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

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

◆ __performMultiIOV()

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

Definition at line 311 of file validateAlignments.py.

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

◆ createJob()

def validateAlignments.ValidationJobMultiIOV.createJob (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 414 of file validateAlignments.py.

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

References validateAlignments.ValidationJobMultiIOV.validations.

◆ getValidation()

def validateAlignments.ValidationJobMultiIOV.getValidation (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 468 of file validateAlignments.py.

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

References validateAlignments.ValidationJobMultiIOV.validations.

◆ needsproxy()

def validateAlignments.ValidationJobMultiIOV.needsproxy (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 471 of file validateAlignments.py.

471  def needsproxy( self ):
472  return [validation.needsproxy() for validation in self.validations].join("and") and not self.preexisting and not self.commandLineOptions.dryRun
473 

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

◆ runCondorJobs()

def validateAlignments.ValidationJobMultiIOV.runCondorJobs (   outdir)
static

Definition at line 421 of file validateAlignments.py.

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

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

◆ runJob()

def validateAlignments.ValidationJobMultiIOV.runJob (   self)

Reimplemented from validateAlignments.ValidationBase.

Definition at line 417 of file validateAlignments.py.

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

References validateAlignments.ValidationJobMultiIOV.validations.

Member Data Documentation

◆ config

validateAlignments.ValidationJobMultiIOV.config

◆ end

validateAlignments.ValidationJobMultiIOV.end

◆ optionMultiIOV

validateAlignments.ValidationJobMultiIOV.optionMultiIOV

Definition at line 301 of file validateAlignments.py.

◆ options

validateAlignments.ValidationJobMultiIOV.options

Definition at line 305 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 306 of file validateAlignments.py.

◆ start

validateAlignments.ValidationJobMultiIOV.start

◆ validation

validateAlignments.ValidationJobMultiIOV.validation

Definition at line 303 of file validateAlignments.py.

◆ validations

validateAlignments.ValidationJobMultiIOV.validations

◆ valSection

validateAlignments.ValidationJobMultiIOV.valSection

Definition at line 355 of file validateAlignments.py.

◆ valType

validateAlignments.ValidationJobMultiIOV.valType
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
mps_setup.append
append
Definition: mps_setup.py:85
format