CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
o2olib.O2OTool Class Reference

Public Member Functions

def create (self)
 
def disable (self)
 
def dumpConf (self)
 
def enable (self)
 
def execute (self)
 
def listConf (self)
 
def listJobs (self)
 
def run (self)
 
def setConfig (self)
 
def setFrequent (self)
 
def setInterval (self)
 
def setup (self, args)
 

Public Attributes

 args
 
 mgr
 

Detailed Description

Definition at line 433 of file o2olib.py.

Member Function Documentation

◆ create()

def o2olib.O2OTool.create (   self)

Definition at line 509 of file o2olib.py.

References PVValHelper.add(), DMRplotter.DMRplotter.args, o2olib.O2OTool.args, o2olib.checkConfiguration(), o2olib.O2OTool.mgr, and o2olib.readConfiguration().

Referenced by o2olib.O2OTool.execute().

509  def create(self):
510  configJson = None
511  if self.args.configFile is not None:
512  if self.args.configString is not None:
513  logging.error('Ambigouous input provided: please specify a configFile OR a configString')
514  return False
515  else:
516  configJson = readConfiguration( self.args.configFile )
517  else:
518  if self.args.configString is None:
519  logging.error('No configuration has been provided: please specify "configFile" or "configString" param.')
520  return False
521  else:
522  configJson = checkConfiguration( self.args.configString )
523  self.mgr.add( self.args.name, configJson, self.args.interval, self.args.frequent, True )
524 
def checkConfiguration(config_string)
Definition: o2olib.py:420
def create(alignables, pedeDump, additionalData, outputFile, config)
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
def readConfiguration(config_filename)
Definition: o2olib.py:404

◆ disable()

def o2olib.O2OTool.disable (   self)

Definition at line 547 of file o2olib.py.

References DMRplotter.DMRplotter.args, o2olib.O2OTool.args, and o2olib.O2OTool.mgr.

Referenced by o2olib.O2OTool.execute().

547  def disable(self):
548  self.mgr.set( self.args.name, False )
549 

◆ dumpConf()

def o2olib.O2OTool.dumpConf (   self)

Definition at line 559 of file o2olib.py.

References DMRplotter.DMRplotter.args, o2olib.O2OTool.args, Herwig7_Dummy_Matchbox_90X_ppToee.dumpConfig, and o2olib.O2OTool.mgr.

Referenced by o2olib.O2OTool.execute().

559  def dumpConf(self):
560  self.mgr.dumpConfig( self.args.name, self.args.versionIndex, self.args.configFile )
561 

◆ enable()

def o2olib.O2OTool.enable (   self)

Definition at line 544 of file o2olib.py.

References DMRplotter.DMRplotter.args, o2olib.O2OTool.args, and o2olib.O2OTool.mgr.

Referenced by o2olib.O2OTool.execute().

544  def enable(self):
545  self.mgr.set( self.args.name, True )
546 

◆ execute()

def o2olib.O2OTool.execute (   self)

Definition at line 435 of file o2olib.py.

References cond::CoralServiceWrapperBase.create(), cond::persistency::ITagTable.create(), cond::CoralServiceWrapper< T >.create(), cond::persistency::GLOBAL_TAG::Table.create(), cond::persistency::TAG::Table.create(), cond::CoralServiceFactory.create(), converter::helper::ConcreteCreator.create(), converter::helper::PolymorphicCreator.create(), cond::persistency::RUN_INFO::Table.create(), cond::persistency::IPayloadTable.create(), cond::persistency::GLOBAL_TAG_MAP::Table.create(), cond::persistency::RunInfoSchema.create(), cond::persistency::IIOVTable.create(), cond::persistency::GTSchema.create(), cond::persistency::PAYLOAD::Table.create(), cond::persistency::ITagAccessPermissionTable.create(), tkal_create_file_lists.FileListCreator.create(), cond::persistency::ITagLogTable.create(), cond::persistency::IIOVSchema.create(), cond::persistency::IOV::Table.create(), cond::persistency::IGTTable.create(), cond::persistency::IGTMapTable.create(), cond::persistency::IGTSchema.create(), cond::persistency::TAG_AUTHORIZATION::Table.create(), cond::persistency::IRunInfoTable.create(), cond::persistency::IRunInfoSchema.create(), cond::persistency::TAG_LOG::Table.create(), cond::persistency::IOVSchema.create(), o2olib.O2OTool.create(), o2olib.O2OTool.disable(), o2olib.O2OTool.dumpConf(), TritonService::FallbackOpts.enable, core.PileUpAnalyzer.PileUpAnalyzer.enable, MessageLogger.enable, o2olib.O2OTool.enable(), o2olib.O2OTool.listConf(), o2olib.O2OJobMgr.listJobs(), o2olib.O2OTool.listJobs(), splitter.FileObj.run, uploader.FileObj.run, uploadPayloads.FileObj.run, RPCRunIOV::RunIOV_Item.run, beamspot::BeamSpotContainer.run, TB06Reco.run, TB06RecoH2.run, RPCDQMObject.run, MultiEventFilter::Event.run, DTCalibrationWorker.DTCalibrationWorker.run(), L1Analysis::L1AnalysisEventDataFormat.run, cond::Utilities.run(), TrackInfoProducerAlgorithm.run(), PFEGammaToCandidateRemapper.run(), SurveyAlignmentAlgorithm.run(), EfficiencyPlotter.run, lumi::Lumi2DB::LumiSource.run, generateEDF.LumiInfo.run, WZInterestingEventSelector::event.run, MuonRecoTest.run, crabWrapper.CrabWrapper.run(), MatacqProducer::MatacqEventId.run, Point.run, DTResolutionAnalysisTest.run, BeamProfile2DBReader::TheBSfromDB.run, options.ConnectionHLTMenu.run, HIPAlignmentAlgorithm.run(), DTWorkflow.DTWorkflow.run(), BeamSpotRcdReader::theBSfromDB.run, DTDataIntegrityTest.run, BeamSpotOnlineRecordsReader::theBSOfromDB.run, DTBlockedROChannelsTest.run, CSCOverlapsAlignmentAlgorithm.run(), DTResolutionTest.run, DTChamberEfficiencyTest.run, ConstantStepOdeSolver.run(), DTEfficiencyTest.run, ME::Header.run, ApeSettingAlgorithm.run(), MuonAlignmentFromReference.run(), personalPlayback.Playback.run, DQMNet::CoreObject.run, MillePedeAlignmentAlgorithm.run(), DTLocalTriggerBaseTest.run, MatrixUtil.InputInfo.run, EcalDeadCellDeltaRFilter.run, QIE8Simulator.run(), HitEff.run, cond::RunInfo_t.run, AlignmentAlgorithmBase.run(), SiStripCondObjectRepresent::SiStripDataContainer< Item, type >.run(), SiPixelErrorEstimation.run, personalPlayback.FrameworkJob.run, l1ct::Event.run, SiPixelTrackingRecHitsValid.run, dqm_interfaces.DirWalkerFile.run, o2olib.O2OTool.run(), JsonOutputProducer::JsonEvent.run, SummaryOutputProducer.run, SummaryOutputProducer::Event.run, o2olib.O2OJobMgr.setConfig(), o2olib.O2OTool.setConfig(), o2olib.O2OTool.setFrequent(), o2olib.O2OJobMgr.setInterval(), o2olib.O2OTool.setInterval(), EcalGeomPhiSymHelper.setup(), HBHERecalibration.setup(), event.Event.setup, HcalTPGScale.setup(), HcalPedestalAnalysis.setup(), CastorPedestalAnalysis.setup(), CaloTPGTranscoderULUT.setup(), querying.connection.setup(), mps_alisetup.SetupAlignment.setup(), NamedCandCombinerBase.setup(), CandCombinerBase< OutputCollection, CandPtr >.setup(), CandCombiner< Selector, PairSelector, Cloner, OutputCollection, Setup >.setup(), looper.Looper.setup, options.HLTProcessOptions.setup, o2olib.O2OTool.setup(), and HcalObjRepresent::ADataRepr.setup().

435  def execute(self):
436  parser = argparse.ArgumentParser(description='CMS o2o command-line tool. For general help (manual page), use the help subcommand.')
437  parser.add_argument('--db', type=str, help='The target database: pro ( for prod ) or dev ( for prep ). default=pro')
438  parser.add_argument("--auth","-a", type=str, help="The path of the authentication file")
439  parser.add_argument('--verbose', '-v', action='count', help='The verbosity level')
440  parser_subparsers = parser.add_subparsers(title='Available subcommands')
441  parser_create = parser_subparsers.add_parser('create', description='Create a new O2O job')
442  parser_create.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
443  parser_create.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path')
444  parser_create.add_argument('--configString', '-s', type=str, help='the JSON configuration string')
445  parser_create.add_argument('--interval', '-i', type=int, help='the chron job interval',default=0)
446  parser_create.add_argument('--frequent', '-f',action='store_true',help='set the "frequent" flag for this job ("false" by default)')
447  parser_create.set_defaults(func=self.create,role=auth.admin_role)
448  parser_setConfig = parser_subparsers.add_parser('setConfig', description='Set a new configuration for the specified job. The configuration is expected as a list of entries "param": "value" (dictionary). The "param" labels will be used to inject the values in the command to execute. The dictionary is stored in JSON format.')
449  parser_setConfig.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
450  parser_setConfig.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path')
451  parser_setConfig.add_argument('--configString', '-s', type=str, help='the JSON configuration string')
452  parser_setConfig.set_defaults(func=self.setConfig,role=auth.admin_role)
453  parser_setFrequent = parser_subparsers.add_parser('setFrequent',description='Set the "frequent" flag for the specified job')
454  parser_setFrequent.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
455  parser_setFrequent.add_argument('--flag', '-f', choices=['0','1'], help='the flag value to set',required=True)
456  parser_setFrequent.set_defaults(func=self.setFrequent,role=auth.admin_role)
457  parser_setInterval = parser_subparsers.add_parser('setInterval',description='Set a new execution interval for the specified job')
458  parser_setInterval.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
459  parser_setInterval.add_argument('--interval', '-i', type=int, help='the chron job interval',required=True)
460  parser_setInterval.set_defaults(func=self.setInterval,role=auth.admin_role)
461  parser_enable = parser_subparsers.add_parser('enable',description='enable the O2O job')
462  parser_enable.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
463  parser_enable.set_defaults(func=self.enable,role=auth.admin_role)
464  parser_disable = parser_subparsers.add_parser('disable',description='disable the O2O job')
465  parser_disable.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
466  parser_disable.set_defaults(func=self.disable,role=auth.admin_role)
467  parser_listJobs = parser_subparsers.add_parser('listJobs', description='list the registered jobs')
468  parser_listJobs.set_defaults(func=self.listJobs,role=auth.reader_role)
469  parser_listConf = parser_subparsers.add_parser('listConfig', description='shows the configurations for the specified job')
470  parser_listConf.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
471  parser_listConf.add_argument('--dump', type=int, help='Dump the specified config.',default=0)
472  parser_listConf.set_defaults(func=self.listConf,role=auth.reader_role)
473  parser_dumpConf = parser_subparsers.add_parser('dumpConfig', description='dumps a specific job configuration version')
474  parser_dumpConf.add_argument('versionIndex', type=str,help='the version to dump')
475  parser_dumpConf.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
476  parser_dumpConf.add_argument('--configFile', '-c', type=str, help='the JSON configuration file name - default:[jobname]_[version].json')
477  parser_dumpConf.set_defaults(func=self.dumpConf,role=auth.reader_role)
478  parser_run = parser_subparsers.add_parser('run', description='Wrapper for O2O jobs execution. Supports input parameter injection from the configuration file associated to the job. The formatting syntax supported are the python ones: "command -paramName {paramLabel}" or "command -paramName %(paramLabel)s". where [paramName] is the name of the parameter required for the command, and [paramLabel] is the key of the parameter entry in the config dictionary (recommended to be equal for clarity!"')
479  parser_run.add_argument('executable', type=str,help='command to execute')
480  parser_run.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
481  parser_run.set_defaults(func=self.run,role=auth.writer_role)
482 
483  args = parser.parse_args()
484 
485  if args.verbose is not None and args.verbose >=1:
486  self.setup(args)
487  return args.func()
488  else:
489  try:
490  self.setup(args)
491  sys.exit( args.func())
492  except Exception as e:
493  logging.error(e)
494  sys.exit(1)
495 

◆ listConf()

def o2olib.O2OTool.listConf (   self)

Definition at line 556 of file o2olib.py.

References DMRplotter.DMRplotter.args, o2olib.O2OTool.args, and o2olib.O2OTool.mgr.

Referenced by o2olib.O2OTool.execute().

556  def listConf(self):
557  self.mgr.listConfig( self.args.name )
558 

◆ listJobs()

def o2olib.O2OTool.listJobs (   self)

Definition at line 553 of file o2olib.py.

References o2olib.O2OTool.mgr.

Referenced by o2olib.O2OTool.execute().

553  def listJobs(self):
554  self.mgr.listJobs()
555 

◆ run()

def o2olib.O2OTool.run (   self)

Definition at line 562 of file o2olib.py.

References DMRplotter.DMRplotter.args, o2olib.O2OTool.args, and o2olib.O2OTool.mgr.

Referenced by Types.EventID.cppID(), Types.LuminosityBlockID.cppID(), and o2olib.O2OTool.execute().

562  def run(self):
563  rmgr = self.mgr.runManager()
564  return rmgr.executeJob( self.args )

◆ setConfig()

def o2olib.O2OTool.setConfig (   self)

Definition at line 525 of file o2olib.py.

References DMRplotter.DMRplotter.args, o2olib.O2OTool.args, o2olib.checkConfiguration(), o2olib.O2OTool.mgr, and o2olib.readConfiguration().

Referenced by o2olib.O2OTool.execute().

525  def setConfig(self):
526  configJson = None
527  if self.args.configFile is not None:
528  if self.args.configString is not None:
529  logging.error('Ambigouous input provided: please specify a configFile OR a configString')
530  return False
531  else:
532  configJson = readConfiguration( self.args.configFile )
533  else:
534  if self.args.configString is None:
535  logging.error('No configuration has been provided: please specify "configFile" or "configString" param.')
536  return False
537  else:
538  configJson = checkConfiguration( self.args.configString )
539  self.mgr.setConfig( self.args.name, configJson )
540 
def checkConfiguration(config_string)
Definition: o2olib.py:420
def readConfiguration(config_filename)
Definition: o2olib.py:404

◆ setFrequent()

def o2olib.O2OTool.setFrequent (   self)

Definition at line 550 of file o2olib.py.

References DMRplotter.DMRplotter.args, o2olib.O2OTool.args, createfilelist.int, and o2olib.O2OTool.mgr.

Referenced by o2olib.O2OTool.execute().

550  def setFrequent(self):
551  self.mgr.set( self.args.name, None, int(self.args.flag) )
552 

◆ setInterval()

def o2olib.O2OTool.setInterval (   self)

Definition at line 541 of file o2olib.py.

References DMRplotter.DMRplotter.args, o2olib.O2OTool.args, and o2olib.O2OTool.mgr.

Referenced by o2olib.O2OTool.execute().

541  def setInterval(self):
542  self.mgr.setInterval( self.args.name, self.args.interval )
543 

◆ setup()

def o2olib.O2OTool.setup (   self,
  args 
)

Definition at line 496 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

496  def setup(self, args):
497  self.args = args
498  db_service = prod_db_service
499  if args.db is not None:
500  if args.db == 'dev' or args.db == 'oradev' :
501  db_service = dev_db_service
502  elif args.db != 'orapro' and args.db != 'onlineorapro' and args.db != 'pro':
503  raise Exception("Database '%s' is not known." %args.db )
504 
505  logLevel = logging.DEBUG if args.verbose is not None and args.verbose >= 1 else logging.INFO
506  self.mgr = O2OJobMgr( logLevel )
507  return self.mgr.connect( db_service, args )
508 

Member Data Documentation

◆ args

◆ mgr