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 435 of file o2olib.py.

Member Function Documentation

def o2olib.O2OTool.create (   self)

Definition at line 505 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

505  def create(self):
506  self.mgr.add( self.args.name, self.args.configFile, self.args.interval, True )
507 
def create(self)
Definition: o2olib.py:505
def o2olib.O2OTool.disable (   self)

Definition at line 517 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

517  def disable(self):
518  self.mgr.set( self.args.name, False )
519 
def disable(self)
Definition: o2olib.py:517
def o2olib.O2OTool.dumpConf (   self)

Definition at line 529 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

529  def dumpConf(self):
530  self.mgr.dumpConfig( self.args.name, self.args.versionIndex, self.args.configFile )
531 
def dumpConf(self)
Definition: o2olib.py:529
def o2olib.O2OTool.enable (   self)

Definition at line 514 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

514  def enable(self):
515  self.mgr.set( self.args.name, True )
516 
def enable(self)
Definition: o2olib.py:514
def o2olib.O2OTool.execute (   self)

Definition at line 437 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(), cond::persistency::IPayloadTable.create(), converter::helper::PolymorphicCreator.create(), cond::persistency::IIOVTable.create(), cond::persistency::RUN_INFO::Table.create(), cond::persistency::GLOBAL_TAG_MAP::Table.create(), cond::persistency::PAYLOAD::Table.create(), cond::persistency::GTSchema.create(), cond::persistency::ITagMigrationTable.create(), cond::persistency::RunInfoSchema.create(), cond::persistency::IPayloadMigrationTable.create(), cond::persistency::ITagLogTable.create(), cond::persistency::IIOVSchema.create(), tkal_create_file_lists.FileListCreator.create(), cond::persistency::IGTTable.create(), cond::persistency::IGTMapTable.create(), cond::persistency::IOV::Table.create(), cond::persistency::IGTSchema.create(), cond::persistency::IRunInfoTable.create(), cond::persistency::TAG_LOG::Table.create(), cond::persistency::IRunInfoSchema.create(), cond::persistency::IOVSchema.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(), cond::Utilities.run(), L1Analysis::L1AnalysisEventDataFormat.run, PFEGammaToCandidateRemapper.run(), TrackInfoProducerAlgorithm.run(), SurveyAlignmentAlgorithm.run(), generateEDF.LumiInfo.run, lumi::Lumi2DB::LumiSource.run, MuonMillepedeAlgorithm.run(), Type1PFMET.run(), EfficiencyPlotter.run, WZInterestingEventSelector::event.run, MuonDTLocalMillepedeAlgorithm.run(), crabWrapper.CrabWrapper.run(), HIPAlignmentAlgorithm.run(), Point.run, options.ConnectionHLTMenu.run, MuonRecoTest.run, DTWorkflow.DTWorkflow.run(), DTResolutionAnalysisTest.run, BeamSpotRcdReader::theBSfromDB.run, MatacqProducer::MatacqEventId.run, CSCOverlapsAlignmentAlgorithm.run(), DTBlockedROChannelsTest.run, DTDataIntegrityTest.run, DTChamberEfficiencyTest.run, DTResolutionTest.run, ApeSettingAlgorithm.run(), ME::Header.run, ConstantStepOdeSolver.run(), DTEfficiencyTest.run, MillePedeAlignmentAlgorithm.run(), MuonAlignmentFromReference.run(), personalPlayback.Playback.run, DQMNet::CoreObject.run, MatrixUtil.InputInfo.run, DTLocalTriggerBaseTest.run, HitEff.run, EcalDeadCellDeltaRFilter.run, QIE8Simulator.run(), AlignmentAlgorithmBase.run(), cond::RunInfo_t.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(), event.Event.setup, EcalGeomPhiSymHelper.setup(), HcalTPGScale.setup(), CaloTPGTranscoderULUT.setup(), CastorPedestalAnalysis.setup(), HcalPedestalAnalysis.setup(), CandCombinerBase< OutputCollection, CandPtr >.setup(), mps_alisetup.SetupAlignment.setup(), querying.connection.setup(), NamedCandCombinerBase.setup(), NamedCandCombiner< Selector, PairSelector, Cloner, Setup >.setup(), looper.Looper.setup, CandCombiner< Selector, PairSelector, Cloner, OutputCollection, Setup >.setup(), options.HLTProcessOptions.setup, o2olib.O2OTool.setup(), and HcalObjRepresent::ADataRepr.setup().

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

Definition at line 526 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

526  def listConf(self):
527  self.mgr.listConfig( self.args.name )
528 
def listConf(self)
Definition: o2olib.py:526
def o2olib.O2OTool.listJobs (   self)

Definition at line 523 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

523  def listJobs(self):
524  self.mgr.listJobs()
525 
def listJobs(self)
Definition: o2olib.py:523
def o2olib.O2OTool.migrate (   self)

Definition at line 520 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

520  def migrate(self):
521  self.mgr.migrateConfig()
522 
def migrate(self)
Definition: o2olib.py:520
def o2olib.O2OTool.run (   self)

Definition at line 532 of file o2olib.py.

References o2olib.O2OTool.args.

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

532  def run(self):
533  rmgr = self.mgr.runManager()
534  return rmgr.executeJob( self.args )
535 
def run(self)
Definition: o2olib.py:532
def o2olib.O2OTool.setConfig (   self)

Definition at line 508 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

508  def setConfig(self):
509  self.mgr.setConfig( self.args.name, self.args.configFile )
510 
def setConfig(self)
Definition: o2olib.py:508
def o2olib.O2OTool.setInterval (   self)

Definition at line 511 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

511  def setInterval(self):
512  self.mgr.setInterval( self.args.name, self.args.interval )
513 
def setInterval(self)
Definition: o2olib.py:511
def o2olib.O2OTool.setup (   self,
  args 
)

Definition at line 493 of file o2olib.py.

Referenced by o2olib.O2OTool.execute().

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

Member Data Documentation

o2olib.O2OTool.args
o2olib.O2OTool.mgr

Definition at line 502 of file o2olib.py.