CMS 3D CMS Logo

Classes | Functions
Utils Namespace Reference

Classes

class  LoadPrerequisiteSource
 

Functions

def addMonitoring (process)
 
def dictIO (options, args)
 
def dqmIOSource (args)
 
def dqmSeq (args, default)
 
def gtNameAndConnect (globalTag, args)
 
def harvestingMode (process, datasetName, args, rANDl=True)
 
def stepALCAPRODUCER (skims)
 
def stepSKIMPRODUCER (PhysicsSkims)
 
def validateProcess (process)
 

Detailed Description

_Utils_

Module containing some utility tools

Function Documentation

def Utils.addMonitoring (   process)
_addMonitoring_

Add the monitoring services to the process provided
in order to write out performance summaries to the framework job report

Definition at line 38 of file Utils.py.

Referenced by Impl.AlCaTestEnable.AlCaTestEnable.expressProcessing(), Reco.Reco.expressProcessing(), and Reco.Reco.promptReco().

38 def addMonitoring(process):
39  """
40  _addMonitoring_
41 
42  Add the monitoring services to the process provided
43  in order to write out performance summaries to the framework job report
44  """
45  import FWCore.ParameterSet.Config as cms
46 
47  process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck",
48  jobReportOutputOnly = cms.untracked.bool(True)
49  )
50  process.Timing = cms.Service("Timing",
51  summaryOnly = cms.untracked.bool(True)
52  )
53 
54  return process
55 
56 
def addMonitoring(process)
Definition: Utils.py:38
def Utils.dictIO (   options,
  args 
)

Definition at line 123 of file Utils.py.

References TriggerAnalyzer.__str__(), and join().

Referenced by Reco.Reco.expressProcessing(), Impl.DataScouting.DataScouting.promptReco(), Impl.AlCa.AlCa.promptReco(), Reco.Reco.promptReco(), and Reco.Reco.visualizationProcessing().

123 def dictIO(options,args):
124  if 'outputs' in args:
125  options.outputDefinition = args['outputs'].__str__()
126  else:
127  writeTiers = args.get('writeTiers', [])
128  options.eventcontent = ','.join(writeTiers)
129  options.datatier = ','.join(writeTiers)
130 
def dictIO(options, args)
Definition: Utils.py:123
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def Utils.dqmIOSource (   args)

Definition at line 103 of file Utils.py.

Referenced by Impl.DataScouting.DataScouting.dqmHarvesting(), Impl.AlCa.AlCa.dqmHarvesting(), and Reco.Reco.dqmHarvesting().

103 def dqmIOSource(args):
104  import FWCore.ParameterSet.Config as cms
105  if args.get('newDQMIO', False):
106  return cms.Source("DQMRootSource",
107  fileNames = cms.untracked(cms.vstring())
108  )
109  else:
110  return cms.Source("PoolSource",
111  fileNames = cms.untracked(cms.vstring())
112  )
113 
def dqmIOSource(args)
Definition: Utils.py:103
def Utils.dqmSeq (   args,
  default 
)

Definition at line 131 of file Utils.py.

References join().

Referenced by Impl.DataScouting.DataScouting.dqmHarvesting(), Reco.Reco.dqmHarvesting(), Reco.Reco.expressProcessing(), and Reco.Reco.promptReco().

131 def dqmSeq(args,default):
132  if 'dqmSeq' in args and len(args['dqmSeq'])!=0:
133  return ':'+('+'.join(args['dqmSeq']))
134  else:
135  return default
136 
def dqmSeq(args, default)
Definition: Utils.py:131
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def Utils.gtNameAndConnect (   globalTag,
  args 
)

Definition at line 137 of file Utils.py.

Referenced by Impl.AlCaTestEnable.AlCaTestEnable.alcaHarvesting(), Reco.Reco.alcaHarvesting(), Impl.DataScouting.DataScouting.dqmHarvesting(), Impl.AlCa.AlCa.dqmHarvesting(), Reco.Reco.dqmHarvesting(), Impl.AlCaTestEnable.AlCaTestEnable.expressProcessing(), Reco.Reco.expressProcessing(), Impl.DataScouting.DataScouting.promptReco(), Impl.AlCa.AlCa.promptReco(), Reco.Reco.promptReco(), Reco.Reco.skimming(), and Reco.Reco.visualizationProcessing().

137 def gtNameAndConnect(globalTag, args):
138  if 'globalTagConnect' in args and args['globalTagConnect'] != '':
139  return globalTag + ','+args['globalTagConnect']
140  # we override here the default in the release which uses the FrontierProd servlet not suited for Tier0 activity
141  return globalTag +',frontier://PromptProd/CMS_CONDITIONS'
142 
def gtNameAndConnect(globalTag, args)
Definition: Utils.py:137
def Utils.harvestingMode (   process,
  datasetName,
  args,
  rANDl = True 
)

Definition at line 114 of file Utils.py.

Referenced by Impl.DataScouting.DataScouting.dqmHarvesting(), Impl.AlCa.AlCa.dqmHarvesting(), and Reco.Reco.dqmHarvesting().

114 def harvestingMode(process, datasetName, args,rANDl=True):
115  import FWCore.ParameterSet.Config as cms
116  if rANDl and (not args.get('newDQMIO', False)):
117  process.source.processingMode = cms.untracked.string('RunsAndLumis')
118  process.dqmSaver.workflow = datasetName
119  process.dqmSaver.saveByLumiSection = 1
120  if 'referenceFile' in args and args.get('referenceFile', ''):
121  process.DQMStore.referenceFileName = cms.untracked.string(args['referenceFile'])
122 
def harvestingMode(process, datasetName, args, rANDl=True)
Definition: Utils.py:114
def Utils.stepALCAPRODUCER (   skims)
_stepALCAPRODUCER_

Creates and returns the configuration string for the ALCAPRODUCER step
starting from the list of AlcaReco path to be run.

Definition at line 9 of file Utils.py.

References join().

Referenced by Impl.AlCaTestEnable.AlCaTestEnable.expressProcessing(), Reco.Reco.expressProcessing(), Impl.AlCa.AlCa.promptReco(), and Reco.Reco.promptReco().

9 def stepALCAPRODUCER(skims):
10  """
11  _stepALCAPRODUCER_
12 
13  Creates and returns the configuration string for the ALCAPRODUCER step
14  starting from the list of AlcaReco path to be run.
15 
16  """
17 
18  step = ''
19  if len(skims) >0:
20  step = ',ALCAPRODUCER:'+('+'.join(skims))
21  return step
22 
23 
def stepALCAPRODUCER(skims)
Definition: Utils.py:9
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def Utils.stepSKIMPRODUCER (   PhysicsSkims)
_stepSKIMPRODUCER_

Creates and returns the configuration string for the SKIM step
starting from the list of skims to be run.

Definition at line 24 of file Utils.py.

References join().

Referenced by Reco.Reco.promptReco().

24 def stepSKIMPRODUCER(PhysicsSkims):
25  """
26  _stepSKIMPRODUCER_
27 
28  Creates and returns the configuration string for the SKIM step
29  starting from the list of skims to be run.
30 
31  """
32 
33  step = ''
34  if len(PhysicsSkims) >0 :
35  step = ',SKIM:'+('+'.join(PhysicsSkims))
36  return step
37 
def stepSKIMPRODUCER(PhysicsSkims)
Definition: Utils.py:24
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def Utils.validateProcess (   process)
_validateProcess_

Check attributes of process are appropriate for production
This method returns nothing but will throw a RuntimeError for any issues it finds
likely to cause problems in the production system

Definition at line 57 of file Utils.py.

References relativeConstraints.keys.

57 def validateProcess(process):
58  """
59  _validateProcess_
60 
61  Check attributes of process are appropriate for production
62  This method returns nothing but will throw a RuntimeError for any issues it finds
63  likely to cause problems in the production system
64 
65  """
66 
67  schedule=process.schedule_()
68  paths=process.paths_()
69  endpaths=process.endpaths_()
70 
71  # check output mods are in paths and have appropriate settings
72  for outputModName in process.outputModules_().keys():
73  outputMod = getattr(process, outputModName)
74  if not hasattr(outputMod, 'dataset'):
75  msg = "Process contains output module without dataset PSET: %s \n" % outputModName
76  msg += " You need to add this PSET to this module to set dataTier and filterName\n"
77  raise RuntimeError(msg)
78  ds=getattr(outputMod,'dataset')
79  if not hasattr(ds, "dataTier"):
80  msg = "Process contains output module without dataTier parameter: %s \n" % outputModName
81  msg += " You need to add an untracked parameter to the dataset PSET of this module to set dataTier\n"
82  raise RuntimeError(msg)
83 
84  # check module in path or whatever (not sure of exact syntax for endpath)
85  omRun=False
86 
87  if schedule==None:
88  for path in paths:
89  if outputModName in getattr(process,path).moduleNames():
90  omRun=True
91  for path in endpaths:
92  if outputModName in getattr(process,path).moduleNames():
93  omRun=True
94  else:
95  for path in schedule:
96  if outputModName in path.moduleNames():
97  omRun=True
98  if omRun==False:
99  msg = "Output Module %s not in endPath" % outputModName
100  raise RuntimeError(msg)
101 
102 
def validateProcess(process)
Definition: Utils.py:57