CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
getPayloadData Namespace Reference

Functions

def deserialize_iovs
 
def discover
 
def discover_plugins
 
def output
 
def supress_output
 

Variables

tuple args = parser.parse_args()
 
string description
 
 filename = None
 
 input_params = None
 
tuple iovDict = yaml.safe_load( args.iovs )
 
tuple parser = ArgumentParser(description=description, formatter_class=RawTextHelpFormatter)
 
tuple result = deserialize_iovs(args.db, args.plugin, args.plot, tags, args.time_type, input_params)
 
list tags = []
 

Function Documentation

def getPayloadData.deserialize_iovs (   db,
  plugin_name,
  plot_name,
  tags,
  time_type,
  input_params 
)
Deserializes given iovs data and returns plot coordinates 

Definition at line 65 of file getPayloadData.py.

References output().

65 
66 def deserialize_iovs(db, plugin_name, plot_name, tags, time_type, input_params):
67  ''' Deserializes given iovs data and returns plot coordinates '''
68 
69  output('Starting to deserialize iovs: ', '')
70  output('db: ', db)
71  output('plugin name: ', plugin_name)
72  output('plot name: ', plot_name)
73  output('tags: ', tags)
74  output('tag time type: ', time_type)
75 
76  plugin_base = import_module('pluginModule_PayloadInspector')
77  output('PI plugin base: ', plugin_base)
78 
79  plugin_obj = import_module(plugin_name)
80  output('PI plugin object: ', plugin_obj)
81 
82  # get plot method and execute it with given iovs
83  plot = getattr(plugin_obj, plot_name)()
84  output('plot object: ', plot)
85 
86  if db == "Prod":
87  db_name = 'frontier://FrontierProd/CMS_CONDITIONS'
88  elif db == 'Prep' :
89  db_name = 'frontier://FrontierPrep/CMS_CONDITIONS'
90  else:
91  db_name = db
92 
93  output('full DB name: ', db_name)
94 
95  if input_params is not None:
96  plot.setInputParamValues( input_params )
97 
98  modv = getattr(plugin_base,'ModuleVersion')
99 
100  success = False
101  if modv.label == '1.0':
102  if len(tags)==1:
103  success = plot.process(db_name, tags[0][0], time_type, int(tags[0][1]), int(tags[0][2]) )
104  elif len(tags)==2:
105  success = plot.processTwoTags(db_name, tags[0][0], tags[1][0], int(tags[0][1]),int(tags[1][1]) )
106  elif modv.label == '2.0':
107  success = plot.process(db_name, tags)
108 
109  output('plot processed data successfully: ', success)
110  if not success:
111  return False
112 
113  result = plot.data()
114  output('deserialized data: ', result)
115  return result
def getPayloadData.discover ( )
Discovers object types and plots for a given cmssw release
    Example:
    {
        "BasicPayload": [
            {"plot": "plot_BeamSpot_x", "plot_type": "History", 
             "single_iov": false, "plugin_name": "pluginBeamSpot_PayloadInspector",
             "title": "x vs run number"},
            ...
        ],
       ...
    }

Definition at line 158 of file getPayloadData.py.

References bitset_utilities.append(), DeadROC_duringRun.dir, discover_plugins(), and output().

159 def discover():
160  ''' Discovers object types and plots for a given cmssw release
161  Example:
162  {
163  "BasicPayload": [
164  {"plot": "plot_BeamSpot_x", "plot_type": "History",
165  "single_iov": false, "plugin_name": "pluginBeamSpot_PayloadInspector",
166  "title": "x vs run number"},
167  ...
168  ],
169  ...
170  }
171  '''
172  plugin_base = import_module('pluginModule_PayloadInspector')
173  modv = getattr(plugin_base,'ModuleVersion')
174  result = {}
175  for plugin_name in discover_plugins():
176  output(' - plugin name: ', plugin_name)
177  plugin_obj = import_module(plugin_name)
178  output('*** PI plugin object: ', plugin_obj)
179  for plot in dir(plugin_obj):
180  if 'plot_' not in plot: continue # skip if method doesn't start with 'plot_' prefix
181  output(' - plot name: ', plot)
182  plot_method= getattr(plugin_obj, plot)()
183  output(' - plot object: ', plot_method)
184  payload_type = plot_method.payloadType()
185  output(' - payload type: ', payload_type)
186  plot_title = plot_method.title()
187  output(' - plot title: ', plot_title)
188  plot_type = plot_method.type()
189  output(' - plot type: ', plot_type)
190  single_iov = plot_method.isSingleIov()
191  output(' - is single iov: ', single_iov)
192  two_tags = plot_method.isTwoTags()
193  output(' - is Two Tags: ', two_tags)
194  plot_dict = { 'plot': plot, 'plugin_name': plugin_name, 'title': plot_title, 'plot_type': plot_type, 'single_iov': single_iov, 'two_tags': two_tags }
195  if modv.label == '2.0':
196  input_params = plot_method.inputParams()
197  output(' - input params: ', len(input_params))
198  plot_dict[ 'input_params'] = input_params
199  result.setdefault(payload_type, []).append( plot_dict )
200  output('currently discovered info: ', result)
201  output('*** final output:', '')
202  return json.dumps(result)
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
def getPayloadData.discover_plugins ( )
Returns a list of Payload Inspector plugin names
    Example:
    ['pluginBasicPayload_PayloadInspector', 'pluginBeamSpot_PayloadInspector', 'pluginSiStrip_PayloadInspector']

Definition at line 116 of file getPayloadData.py.

References if(), output(), and python.rootplot.root2matplotlib.replace().

Referenced by discover().

117 def discover_plugins():
118  ''' Returns a list of Payload Inspector plugin names
119  Example:
120  ['pluginBasicPayload_PayloadInspector', 'pluginBeamSpot_PayloadInspector', 'pluginSiStrip_PayloadInspector']
121  '''
122  architecture = os.environ.get('SCRAM_ARCH', None)
123  output('architecture: ', architecture)
124 
125  plugins = []
126  releases = [
127  os.environ.get('CMSSW_BASE', None),
128  os.environ.get('CMSSW_RELEASE_BASE', None),
129  os.environ.get('CMSSW_FULL_RELEASE_BASE', None)
130  ]
131 
132  for r in releases:
133  if not r: continue # skip if release base is not specified
134  output('* release: ', r)
135 
136  path = os.path.join(r, 'lib', architecture)
137  output('* full release path: ', path)
138 
139  plugins += glob.glob(path + '/plugin*_PayloadInspector.so' )
140  output('found plugins: ', plugins)
141 
142  # If no plugins are found in the local release,
143  # go find them in the release base (or full release base, in case of patches)
144  if(len(plugins)==0):
145  output('# plugins found:',len(plugins))
146  else:
147  if r: break # break loop if CMSSW_BASE is specified
148 
149  # extracts the object name from plugin path:
150  # /afs/cern.ch/cms/slc6_amd64_gcc493/cms/cmssw/CMSSW_8_0_6/lib/slc6_amd64_gcc493/pluginBasicPayload_PayloadInspector.so
151  # becomes pluginBasicPayload_PayloadInspector
152  result = []
153  for p in plugins:
154  result.append(p.split('/')[-1].replace('.so', ''))
155 
156  output('discovered plugins: ', result)
157  return result
if(conf_.getParameter< bool >("UseStripCablingDB"))
def getPayloadData.output (   description,
  param 
)

Definition at line 203 of file getPayloadData.py.

References print().

Referenced by deserialize_iovs(), discover(), and discover_plugins().

204 def output(description, param):
205  if args.verbose:
206  print('')
207  print(description, param)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def getPayloadData.supress_output (   f)
Temporarily disables stdout and stderr so that printouts from the plot
plugin does not compromise the purity of our ssh stream if 
args.suppress_output is true

Definition at line 22 of file getPayloadData.py.

References validate-o2o-wbm.f.

22 
23 def supress_output( f ):
24  '''
25  Temporarily disables stdout and stderr so that printouts from the plot
26  plugin does not compromise the purity of our ssh stream if
27  args.suppress_output is true
28  '''
29  def decorated( *fargs, **fkwargs ):
30 
31  suppress = args.suppress_output
32  if suppress:
33 
34  # Get rid of what is already there ( should be nothing for this script )
35  sys.stdout.flush()
36 
37  # Save file descriptors so it can be reactivated later
38  saved_stdout = os.dup( 1 )
39  saved_stderr = os.dup( 2 )
40 
41  # /dev/null is used just to discard what is being printed
42  devnull = os.open( '/dev/null', os.O_WRONLY )
43 
44  # Duplicate the file descriptor for /dev/null
45  # and overwrite the value for stdout (file descriptor 1)
46  os.dup2( devnull, 1 )
47  os.dup2( devnull, 2 )
48 
49  result = f( *fargs, **fkwargs )
50 
51  if suppress:
52 
53  # Close devnull after duplication (no longer needed)
54  os.close( devnull )
55 
56  # Reenable stdout and stderr
57  os.dup2( saved_stdout, 1 )
58  os.dup2( saved_stderr, 2 )
59 
60  return result
61 
62  return decorated
63 
64 
@supress_output

Variable Documentation

tuple getPayloadData.args = parser.parse_args()

Definition at line 260 of file getPayloadData.py.

string getPayloadData.description
Initial value:
1 = '''
2  Payload Inspector - data visualisation tool which is integrated into the cmsDbBrowser.
3  It allows to display plots and monitor the calibration and alignment data.
4 
5  You can access Payload Inspector with a link below:
6  https://cms-conddb.cern.ch/cmsDbBrowser/payload_inspector/Prod
7 
8  This script is a part of the Payload Inspector service and is responsible for:
9  a) discovering PI objects that are available in a given cmssw release
10  b) deserializing payload data which is later used as plot coordinates
11  c) testing new PI objects which are under development
12 
13  To test new PI objects please do the following:
14  a) run ./getPayloadData.py --discover
15  to check if your newly created object is found by the script.
16  Please note that we strongly rely on naming conventions so if you don't
17  see your object listed you probably misnamed it in objectType() method.
18  Also all plot methods should start with "plot_" prefix.
19 
20  b) second step is to test if it returns data correctly:
21  run ./getPayloadData.py --plugin YourPIPluginName --plot YourObjectPlot --tag tagName --time_type Run --iovs '{"start_iov": "201", "end_iov": "801"}' --db Prod --test
22 
23  Here is an example for BasicPayload object:
24  run ./getPayloadData.py --plugin pluginBasicPayload_PayloadInspector --plot plot_BasicPayload_data0 --tag BasicPayload_v2 --time_type Run --iovs '{"start_iov": "201", "end_iov": "801"}' --db Prod --test
25 
26  c) if it works correctly please make a pull request and once it's accepted
27  go to cmsDbBrowser and wait for the next IB to test it.
28  '''

Definition at line 210 of file getPayloadData.py.

Referenced by optutl::VariableMapCont._checkKey(), cms::cuda.abortOnCudaError(), cms::cuda.abortOnNvmlError(), edm::eventsetup::looper.addFinderTo(), edm::eventsetup.addProviderTo(), edm::eventsetup::looper.addProviderTo(), edm::eventsetup::ComponentMaker< T, TComponent >.addTo(), edm::EventProcessor.beginJob(), edm.checkForModuleDependencyCorrectness(), ConfFitterBuilder< O >.ConfFitterBuilder(), ConfRecoBuilder< O >.ConfRecoBuilder(), sistrip::SpyEventMatcher.constructSource(), edm::eventsetup::ComponentMakerBaseHelper.createComponentDescription(), SiStripHistoId.createHistoId(), SiStripHistoId.createHistoLayer(), cms::cuda.cudaCheck_(), SiStripConfigDb.deviceAddress(), ExpressionHisto< T >.initialize(), edm::SubProcess.keepOnlyConsumedUnscheduledModules(), edm.nonConsumedUnscheduledModules(), ExceptionHandler.Notify(), cms::cuda.nvmlCheck_(), optutl::CommandLineParser.printOptionValues(), edm::PathsAndConsumesOfModules.removeModules(), edm::WorkerT< T >.resolvePutIndicies(), SiStripCondObjBuilderFromDb.setValuesCabling(), TwoObjectVariable< LHS, lLHS, RHS, lRHS, Calculator >.TwoObjectVariable(), edm.validateTopLevelParameterSets(), l1tVertexFinder::VertexNTupler.VertexNTupler(), npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >.write(), npstat::StorableInterpolationFunctor< Numeric, Axis, Converter >.write(), edm::OutputModuleCommunicatorT< T >.writeLumiAsync(), edm::OutputModuleCommunicatorT< T >.writeProcessBlockAsync(), and edm::OutputModuleCommunicatorT< T >.writeRunAsync().

tuple getPayloadData.filename = None

Definition at line 287 of file getPayloadData.py.

tuple getPayloadData.input_params = None

Definition at line 266 of file getPayloadData.py.

tuple getPayloadData.iovDict = yaml.safe_load( args.iovs )

Definition at line 272 of file getPayloadData.py.

tuple getPayloadData.parser = ArgumentParser(description=description, formatter_class=RawTextHelpFormatter)

Definition at line 239 of file getPayloadData.py.

tuple getPayloadData.result = deserialize_iovs(args.db, args.plugin, args.plot, tags, args.time_type, input_params)

Definition at line 278 of file getPayloadData.py.

list getPayloadData.tags = []

Definition at line 270 of file getPayloadData.py.

Referenced by SiStripGainFromCalibTree.algoEndRun(), algorithm(), pat::CandidateSummaryTable.analyze(), MixCollectionValidation.bookHistograms(), MuonOffsetFromDD.build(), CaloTruthAccumulator.CaloTruthAccumulator(), edm::CFWriter.CFWriter(), ChainedJetCorrectorProducer.ChainedJetCorrectorProducer(), ConvertingESProducerWithDependenciesT< CombinedRecord< DepsRecords...>, Target, Dependencies...>.ConvertingESProducerWithDependenciesT(), HLTConfigData.dump(), IsoTrig.fillDescriptions(), models.generate(), SiStripSummaryCreator.getSummaryME(), GoodSeedProducer.GoodSeedProducer(), FWPSetTableManager.handleEntry(), edm::HiMixingModule.HiMixingModule(), cond::persistency::GLOBAL_TAG_MAP::Table.insert(), L1Comparator.L1Comparator(), LightPFTrackProducer.LightPFTrackProducer(), LowPtGsfElectronSeedValueMapsProducer.LowPtGsfElectronSeedValueMapsProducer(), edm::MixingModule.MixingModule(), L1TPhase2CorrelatorOffline::MultiCollection.MultiCollection(), edm.operator<<(), PFLinker.PFLinker(), PFNuclearProducer.PFNuclearProducer(), PFProducer.PFProducer(), PFTrackProducer.PFTrackProducer(), PFV0Producer.PFV0Producer(), ParticleLevelProducer.produce(), GenJetTauTaggerProducer.produce(), BTagProbabilityToDiscriminator.produce(), TriggerSummaryProducerAOD.produce(), pathelpers::RecordCache.RecordCache(), cond::persistency::GLOBAL_TAG_MAP::Table.select(), ElectronHEEPIDValueMapProducer.setToken(), SimHitTPAssociationProducer.SimHitTPAssociationProducer(), and TrackingTruthAccumulator.TrackingTruthAccumulator().