CMS 3D CMS Logo

Functions | Variables
getPayloadData Namespace Reference

Functions

def deserialize_iovs (db, plugin_name, plot_name, tags, time_type, input_params)
 
def discover ()
 
def discover_plugins ()
 
def output (description, param)
 
def supress_output (f)
 

Variables

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

Function Documentation

◆ deserialize_iovs()

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 createfilelist.int.

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

◆ discover()

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 mps_setup.append, DeadROC_duringRun.dir, and discover_plugins().

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

◆ discover_plugins()

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 ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets.if(), and python.rootplot.root2matplotlib.replace().

Referenced by discover().

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

◆ output()

def getPayloadData.output (   description,
  param 
)

Definition at line 203 of file getPayloadData.py.

References print().

203 def output(description, param):
204  if args.verbose:
205  print('')
206  print(description, param)
207 
def output(description, param)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ supress_output()

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 f.

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

Variable Documentation

◆ action

getPayloadData.action

Definition at line 240 of file getPayloadData.py.

◆ args

getPayloadData.args = parser.parse_args()

Definition at line 260 of file getPayloadData.py.

◆ description

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.

◆ filename

getPayloadData.filename = None

Definition at line 287 of file getPayloadData.py.

◆ help

getPayloadData.help

Definition at line 240 of file getPayloadData.py.

◆ input_params

getPayloadData.input_params = None

Definition at line 266 of file getPayloadData.py.

◆ iovDict

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

Definition at line 272 of file getPayloadData.py.

◆ parser

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

Definition at line 239 of file getPayloadData.py.

◆ result

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

Definition at line 278 of file getPayloadData.py.

◆ tags

list getPayloadData.tags = []

Definition at line 270 of file getPayloadData.py.

Referenced by ParticleLevelProducer.addGenJet(), SiStripGainFromCalibTree.algoEndRun(), algorithm(), pat::CandidateSummaryTable.analyze(), MixCollectionValidation.bookHistograms(), MuonOffsetFromDD.build(), CaloTruthAccumulator.CaloTruthAccumulator(), edm::CFWriter.CFWriter(), ChainedJetCorrectorProducer.ChainedJetCorrectorProducer(), CondHDF5ESSource.CondHDF5ESSource(), ConvertingESProducerWithDependenciesT< CombinedRecord< DepsRecords... >, Target, Dependencies... >.ConvertingESProducerWithDependenciesT(), HLTConfigData.dump(), IsoTrig.fillDescriptions(), SmartSelectionMonitor.fillHisto(), SmartSelectionMonitor.fillProfile(), TriggerSummaryProducerAOD.fillTriggerObjectCollections(), models.generate(), L6SLBCorrectorImpl.getBTagInfoIndex(), SiStripSummaryCreator.getSummaryME(), DeDxEstimatorRekeyer.getTokens(), GoodSeedProducer.GoodSeedProducer(), FWPSetTableManager.handleEntry(), HGCalPassivePartial.HGCalPassivePartial(), edm::HiMixingModule.HiMixingModule(), cond::persistency::GLOBAL_TAG_MAP::Table.insert(), ConvertingESProducerWithDependenciesT< CombinedRecord< DepsRecords... >, Target, Dependencies... >::WalkConsumes< N >.iterate(), LightPFTrackProducer.LightPFTrackProducer(), LowPtGsfElectronSeedValueMapsProducer.LowPtGsfElectronSeedValueMapsProducer(), edm::MixingModule.MixingModule(), MtdTruthAccumulator.MtdTruthAccumulator(), L1TPhase2CorrelatorOffline::MultiCollection.MultiCollection(), edm.operator<<(), PFLinker.PFLinker(), PFNuclearProducer.PFNuclearProducer(), PFTrackProducer.PFTrackProducer(), PFV0Producer.PFV0Producer(), PixelClusterCountsAuditor.PixelClusterCountsAuditor(), ParticleLevelProducer.produce(), GenJetTauTaggerProducer.produce(), BTagProbabilityToDiscriminator.produce(), TriggerSummaryProducerAOD.produce(), pathelpers::RecordCache.RecordCache(), PPSTimingCalibrationPCLWorker.searchForProduct(), PPSDiamondSampicTimingCalibrationPCLWorker.searchForProduct(), cond::persistency::GLOBAL_TAG_MAP::Table.select(), ElectronHEEPIDValueMapProducer.setToken(), SuperclusValueMapProducer.setTokens(), SimHitTPAssociationProducer.SimHitTPAssociationProducer(), and TrackingTruthAccumulator.TrackingTruthAccumulator().