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 migrate (self)
 
def run (self)
 
def setConfig (self)
 
def setInterval (self)
 
def setup (self, args)
 

Public Attributes

 args
 
 mgr
 

Detailed Description

Definition at line 434 of file o2olib.py.

Member Function Documentation

◆ create()

def o2olib.O2OTool.create (   self)

Definition at line 504 of file o2olib.py.

504  def create(self):
505  self.mgr.add( self.args.name, self.args.configFile, self.args.interval, True )
506 

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

Referenced by o2olib.O2OTool.execute().

◆ disable()

def o2olib.O2OTool.disable (   self)

Definition at line 516 of file o2olib.py.

516  def disable(self):
517  self.mgr.set( self.args.name, False )
518 

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

Referenced by o2olib.O2OTool.execute().

◆ dumpConf()

def o2olib.O2OTool.dumpConf (   self)

Definition at line 528 of file o2olib.py.

528  def dumpConf(self):
529  self.mgr.dumpConfig( self.args.name, self.args.versionIndex, self.args.configFile )
530 

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

Referenced by o2olib.O2OTool.execute().

◆ enable()

def o2olib.O2OTool.enable (   self)

Definition at line 513 of file o2olib.py.

513  def enable(self):
514  self.mgr.set( self.args.name, True )
515 

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

Referenced by o2olib.O2OTool.execute().

◆ execute()

def o2olib.O2OTool.execute (   self)

Definition at line 436 of file o2olib.py.

436  def execute(self):
437  parser = argparse.ArgumentParser(description='CMS o2o command-line tool. For general help (manual page), use the help subcommand.')
438  parser.add_argument('--db', type=str, help='The target database: pro ( for prod ) or dev ( for prep ). default=pro')
439  parser.add_argument("--auth","-a", type=str, help="The path of the authentication file")
440  parser.add_argument('--verbose', '-v', action='count', help='The verbosity level')
441  parser_subparsers = parser.add_subparsers(title='Available subcommands')
442  parser_create = parser_subparsers.add_parser('create', description='Create a new O2O job')
443  parser_create.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
444  parser_create.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path',required=True)
445  parser_create.add_argument('--interval', '-i', type=int, help='the chron job interval',default=0)
446  parser_create.set_defaults(func=self.create)
447  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.')
448  parser_setConfig.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
449  parser_setConfig.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path',required=True)
450  parser_setConfig.set_defaults(func=self.setConfig)
451  parser_setInterval = parser_subparsers.add_parser('setInterval',description='Set a new execution interval for the specified job')
452  parser_setInterval.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
453  parser_setInterval.add_argument('--interval', '-i', type=int, help='the chron job interval',required=True)
454  parser_setInterval.set_defaults(func=self.setInterval)
455  parser_enable = parser_subparsers.add_parser('enable',description='enable the O2O job')
456  parser_enable.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
457  parser_enable.set_defaults(func=self.enable)
458  parser_disable = parser_subparsers.add_parser('disable',description='disable the O2O job')
459  parser_disable.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
460  parser_disable.set_defaults(func=self.disable)
461  parser_migrateConf = parser_subparsers.add_parser('migrateConfig',description='migrate the tag info for the jobs in configuration entries')
462  parser_migrateConf.set_defaults(func=self.migrate)
463  parser_listJobs = parser_subparsers.add_parser('listJobs', description='list the registered jobs')
464  parser_listJobs.set_defaults(func=self.listJobs)
465  parser_listConf = parser_subparsers.add_parser('listConfig', description='shows the configurations for the specified job')
466  parser_listConf.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
467  parser_listConf.add_argument('--dump', type=int, help='Dump the specified config.',default=0)
468  parser_listConf.set_defaults(func=self.listConf)
469  parser_dumpConf = parser_subparsers.add_parser('dumpConfig', description='dumps a specific job configuration version')
470  parser_dumpConf.add_argument('versionIndex', type=str,help='the version to dump')
471  parser_dumpConf.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
472  parser_dumpConf.add_argument('--configFile', '-c', type=str, help='the JSON configuration file name - default:[jobname]_[version].json')
473  parser_dumpConf.set_defaults(func=self.dumpConf)
474  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!"')
475  parser_run.add_argument('executable', type=str,help='command to execute')
476  parser_run.add_argument('--name', '-n', type=str, help='The o2o job name',required=True)
477  parser_run.set_defaults(func=self.run)
478 
479  args = parser.parse_args()
480 
481  if args.verbose >=1:
482  self.setup(args)
483  return args.func()
484  else:
485  try:
486  self.setup(args)
487  sys.exit( args.func())
488  except Exception as e:
489  logging.error(e)
490  sys.exit(1)
491 

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::IIOVTable.create(), cond::persistency::RunInfoSchema.create(), cond::persistency::PAYLOAD::Table.create(), cond::persistency::GTSchema.create(), cond::persistency::ITagMigrationTable.create(), tkal_create_file_lists.FileListCreator.create(), cond::persistency::IPayloadMigrationTable.create(), cond::persistency::ITagLogTable.create(), cond::persistency::IOV::Table.create(), cond::persistency::IIOVSchema.create(), cond::persistency::IGTTable.create(), cond::persistency::IGTMapTable.create(), cond::persistency::TAG_LOG::Table.create(), cond::persistency::IGTSchema.create(), cond::persistency::IOVSchema.create(), cond::persistency::IRunInfoTable.create(), cond::persistency::IRunInfoSchema.create(), o2olib.O2OTool.create(), o2olib.O2OTool.disable(), o2olib.O2OTool.dumpConf(), core.PileUpAnalyzer.PileUpAnalyzer.enable, o2olib.O2OTool.enable(), o2olib.O2OTool.listConf(), o2olib.O2OJobMgr.listJobs(), o2olib.O2OTool.listJobs(), o2olib.O2OTool.migrate(), 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(), MuonMillepedeAlgorithm.run(), EfficiencyPlotter.run, lumi::Lumi2DB::LumiSource.run, Type1PFMET.run(), generateEDF.LumiInfo.run, WZInterestingEventSelector::event.run, MuonRecoTest.run, MuonDTLocalMillepedeAlgorithm.run(), crabWrapper.CrabWrapper.run(), HIPAlignmentAlgorithm.run(), DTResolutionAnalysisTest.run, options.ConnectionHLTMenu.run, DTWorkflow.DTWorkflow.run(), Point.run, MatacqProducer::MatacqEventId.run, BeamSpotRcdReader::theBSfromDB.run, BeamSpotOnlineHLTRcdReader::theBSOfromDB.run, BeamSpotOnlineLegacyRcdReader::theBSOfromDB.run, DTDataIntegrityTest.run, DTBlockedROChannelsTest.run, CSCOverlapsAlignmentAlgorithm.run(), DTChamberEfficiencyTest.run, DTResolutionTest.run, ConstantStepOdeSolver.run(), ME::Header.run, DTEfficiencyTest.run, ApeSettingAlgorithm.run(), MillePedeAlignmentAlgorithm.run(), MuonAlignmentFromReference.run(), DQMNet::CoreObject.run, personalPlayback.Playback.run, DTLocalTriggerBaseTest.run, MatrixUtil.InputInfo.run, HitEff.run, QIE8Simulator.run(), EcalDeadCellDeltaRFilter.run, cond::RunInfo_t.run, AlignmentAlgorithmBase.run(), SiPixelErrorEstimation.run, personalPlayback.FrameworkJob.run, SiPixelTrackingRecHitsValid.run, o2olib.O2OTool.run(), dqm_interfaces.DirWalkerFile.run, JsonOutputProducer::JsonEvent.run, SummaryOutputProducer.run, SummaryOutputProducer::Event.run, o2olib.O2OJobMgr.setConfig(), o2olib.O2OTool.setConfig(), o2olib.O2OJobMgr.setInterval(), o2olib.O2OTool.setInterval(), HBHERecalibration.setup(), EcalGeomPhiSymHelper.setup(), event.Event.setup, HcalTPGScale.setup(), HcalPedestalAnalysis.setup(), CaloTPGTranscoderULUT.setup(), CastorPedestalAnalysis.setup(), NamedCandCombinerBase.setup(), mps_alisetup.SetupAlignment.setup(), querying.connection.setup(), CandCombinerBase< OutputCollection, CandPtr >.setup(), CandCombiner< Selector, PairSelector, Cloner, OutputCollection, Setup >.setup(), NamedCandCombiner< Selector, PairSelector, Cloner, Setup >.setup(), looper.Looper.setup, options.HLTProcessOptions.setup, o2olib.O2OTool.setup(), and HcalObjRepresent::ADataRepr.setup().

◆ listConf()

def o2olib.O2OTool.listConf (   self)

Definition at line 525 of file o2olib.py.

525  def listConf(self):
526  self.mgr.listConfig( self.args.name )
527 

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

Referenced by o2olib.O2OTool.execute().

◆ listJobs()

def o2olib.O2OTool.listJobs (   self)

Definition at line 522 of file o2olib.py.

522  def listJobs(self):
523  self.mgr.listJobs()
524 

References o2olib.O2OTool.mgr.

Referenced by o2olib.O2OTool.execute().

◆ migrate()

def o2olib.O2OTool.migrate (   self)

Definition at line 519 of file o2olib.py.

519  def migrate(self):
520  self.mgr.migrateConfig()
521 

References o2olib.O2OTool.mgr.

Referenced by o2olib.O2OTool.execute().

◆ run()

def o2olib.O2OTool.run (   self)

Definition at line 531 of file o2olib.py.

531  def run(self):
532  rmgr = self.mgr.runManager()
533  return rmgr.executeJob( self.args )

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

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

◆ setConfig()

def o2olib.O2OTool.setConfig (   self)

Definition at line 507 of file o2olib.py.

507  def setConfig(self):
508  self.mgr.setConfig( self.args.name, self.args.configFile )
509 

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

Referenced by o2olib.O2OTool.execute().

◆ setInterval()

def o2olib.O2OTool.setInterval (   self)

Definition at line 510 of file o2olib.py.

510  def setInterval(self):
511  self.mgr.setInterval( self.args.name, self.args.interval )
512 

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

Referenced by o2olib.O2OTool.execute().

◆ setup()

def o2olib.O2OTool.setup (   self,
  args 
)

Definition at line 492 of file o2olib.py.

492  def setup(self, args):
493  self.args = args
494  db_service = prod_db_service
495  if args.db is not None:
496  if args.db == 'dev' or args.db == 'oradev' :
497  db_service = dev_db_service
498  elif args.db != 'orapro' and args.db != 'onlineorapro' and args.db != 'pro':
499  raise Exception("Database '%s' is not known." %args.db )
500 
501  self.mgr = O2OJobMgr()
502  return self.mgr.connect( db_service, args )
503 

Referenced by o2olib.O2OTool.execute().

Member Data Documentation

◆ args

o2olib.O2OTool.args

◆ mgr

o2olib.O2OTool.mgr
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
PVValHelper::add
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Definition: PVValidationHelpers.cc:12
Exception
particleFlowBadHcalPseudoCluster_cfi.enable
enable
Definition: particleFlowBadHcalPseudoCluster_cfi.py:5
DBConfiguration_cff.connect
connect
Definition: DBConfiguration_cff.py:18
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Herwig7_Dummy_Matchbox_90X_ppToee.dumpConfig
dumpConfig
Definition: Herwig7_Dummy_Matchbox_90X_ppToee.py:8