test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
o2o.O2ORunMgr Class Reference
Inheritance diagram for o2o.O2ORunMgr:
o2o.O2OMgr

Public Member Functions

def __init__
 
def connect
 
def endJob
 
def executeJob
 
def log
 
def startJob
 
- Public Member Functions inherited from o2o.O2OMgr
def __init__
 
def getSession
 
def logger
 

Public Attributes

 db_connection
 
 end
 
 job_name
 
 session
 
 start
 
 tag_name
 
 verbose
 
- Public Attributes inherited from o2o.O2OMgr
 eng
 
 logger
 

Detailed Description

Definition at line 130 of file o2o.py.

Constructor & Destructor Documentation

def o2o.O2ORunMgr.__init__ (   self)

Definition at line 132 of file o2o.py.

133  def __init__( self ):
134  O2OMgr.__init__(self)
135  self.job_name = None
136  self.start = None
137  self.end = None
138  self.tag_name = None
139  self.db_connection = None
def __init__
Definition: o2o.py:132
db_connection
Definition: o2o.py:138

Member Function Documentation

def o2o.O2ORunMgr.connect (   self,
  service,
  args 
)

Definition at line 147 of file o2o.py.

Referenced by Vispa.Gui.ZoomableScrollArea.ZoomableScrollArea.__init__(), Vispa.Views.PropertyView.BooleanProperty.__init__(), Vispa.Gui.FindDialog.FindDialog._addScript(), Vispa.Gui.FindDialog.FindDialog._addStringProperty(), Vispa.Main.Application.Application._connectSignals(), Vispa.Plugins.ConfigEditor.CodeTableView.CodeTableView._createItem(), Vispa.Gui.BoxContentDialog.BoxContentDialog.addButton(), Vispa.Gui.ToolBoxContainer.ToolBoxContainer.addWidget(), Vispa.Views.PropertyView.PropertyView.append(), Vispa.Views.PropertyView.PropertyView.appendAddRow(), Vispa.Main.Application.Application.createAction(), Vispa.Views.PropertyView.TextEditWithButtonProperty.createButton(), Vispa.Views.LineDecayView.LineDecayView.createLineDecayContainer(), Vispa.Views.PropertyView.TextEditWithButtonProperty.createLineEdit(), Vispa.Views.LineDecayView.LineDecayContainer.createObject(), Vispa.Views.PropertyView.TextEditWithButtonProperty.createTextEdit(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.filterDialog(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.find(), Vispa.Gui.PortWidget.PortWidget.mouseMoveEvent(), Vispa.Views.PropertyView.BooleanProperty.setChecked(), Vispa.Main.SplitterTab.SplitterTab.setController(), Vispa.Plugins.Browser.BrowserTab.BrowserTab.setController(), Vispa.Views.PropertyView.BooleanProperty.setReadOnly(), Vispa.Views.PropertyView.DropDownProperty.setReadOnly(), Vispa.Views.PropertyView.TextEditWithButtonProperty.setReadOnly(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.setTab(), Vispa.Views.PropertyView.IntegerProperty.setValue(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.switchCenterView(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController.updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController.updateViewMenu().

148  def connect( self, service, args ):
149  self.session = O2OMgr.getSession( self,service, args.auth )
150  self.verbose = args.verbose
151  if self.session is None:
152  return False
153  else:
154  self.db_connection = coral_tpl %(service[0],schema_name)
155  return True
db_connection
Definition: o2o.py:138
def connect
Definition: o2o.py:147
def o2o.O2ORunMgr.endJob (   self,
  status,
  log 
)

Definition at line 181 of file o2o.py.

References poly< T >::const_iterator.end, o2o.O2ORunMgr.end, svgfig.LineAxis.end, relativeConstraints.error, info(), o2o.O2ORun.job_name, o2o.O2ORunMgr.job_name, o2o.O2ORunMgr.start, and svgfig.LineAxis.start.

Referenced by o2o.O2ORunMgr.executeJob().

182  def endJob( self, status, log ):
183  self.end = datetime.now()
184  try:
185  run = O2ORun(job_name=self.job_name,start_time=self.start,end_time=self.end,status_code=status,log=log)
186  self.session.merge(run)
187  self.session.commit()
188  O2OMgr.logger( self ).info( 'Job %s ended.', self.job_name )
189  except sqlalchemy.exc.SQLAlchemyError as dberror:
190  O2OMgr.logger( self ).error( str(dberror) )
def endJob
Definition: o2o.py:181
static const TGPicture * info(bool iBackgroundIsBlack)
def o2o.O2ORunMgr.executeJob (   self,
  args 
)

Definition at line 191 of file o2o.py.

References o2o.O2ORunMgr.db_connection, HcalLutGenerator.endJob(), sistrip::EnsembleCalibrationLA.endJob(), HcalCableMapper.endJob(), SiStripDetVOffHandler.endJob(), EcalStatusAnalyzer.endJob(), PhiSymmetryCalibration_step2.endJob(), PhiSymmetryCalibration_step2_SM.endJob(), RawDataConverter.endJob(), CandPtrProjector.endJob(), CPUSpender.endJob(), EcalTPGParamReaderFromDB.endJob(), EcalMatacqAnalyzer.endJob(), SiStripDetVOffTkMapPlotter.endJob(), EcalPerEvtMatacqAnalyzer.endJob(), AlcaBeamSpotHarvester.endJob(), DTCalibMuonSelection.endJob(), DTTPAnalyzer.endJob(), AlignmentPrescaler.endJob(), EcalDigiDisplay.endJob(), LSNumberFilter.endJob(), SiStripQualityStatistics.endJob(), ObjectCounter< C >.endJob(), TkAlCaSkimTreeMerger.endJob(), EcalPnGraphs.endJob(), DTVDriftWriter.endJob(), DTVDriftSegmentCalibration.endJob(), SiStripDetVOffTrendPlotter.endJob(), popcon::PopConAnalyzer< S >.endJob(), CandidateTriggerObjectProducer.endJob(), AlcaBeamSpotFromDB.endJob(), SiPixelFedFillerWordEventNumber.endJob(), DTMapGenerator.endJob(), DTTTrigCorrectionFirst.endJob(), AlignmentStats.endJob(), WriteEcalMiscalibConstants.endJob(), WriteEcalMiscalibConstantsMC.endJob(), DTT0Correction.endJob(), DTTTrigCorrection.endJob(), DTTTrigOffsetCalibration.endJob(), HcalCalibrator.endJob(), DTResidualCalibration.endJob(), SurveyDataConverter.endJob(), SubdetFEDSelector.endJob(), ShallowTree.endJob(), LaserDQM.endJob(), PuppiProducer.endJob(), FilterOutLowPt.endJob(), SiStripRegFEDSelector.endJob(), FilterTrackerOn.endJob(), MuonAlignmentPreFilter.endJob(), SiStripLAProfileBooker.endJob(), AlCaElectronsTest.endJob(), TkVoltageMapCreator.endJob(), ValidationMisalignedTracker.endJob(), DTTTrigWriter.endJob(), DTNoiseCalibration.endJob(), DTT0Calibration.endJob(), DTTPDeadWriter.endJob(), EcalIsolatedParticleCandidateProducer.endJob(), EcalPedHists.endJob(), DTT0CalibrationNew.endJob(), miscalibExample.endJob(), LaserAlignmentT0Producer.endJob(), IsolatedParticlesGeneratedJets.endJob(), BooleanFlagFilter.endJob(), DTVDriftCalibration.endJob(), EcalABAnalyzer.endJob(), EcalPerEvtLaserAnalyzer.endJob(), SurveyDBUploader.endJob(), AlCaDiJetsProducer.endJob(), DTTTrigCalibration.endJob(), ECALRegFEDSelector.endJob(), EcalTestPulseAnalyzer.endJob(), SiPixelCalibDigiFilter.endJob(), EcalPedOffset.endJob(), AlCaGammaJetProducer.endJob(), CSCOverlapsBeamSplashCut.endJob(), Tracker_OldtoNewConverter.endJob(), cms::ProducerAnalyzer.endJob(), JetConstituentSelector< T, C >.endJob(), DTNoiseComputation.endJob(), MuonAlignmentAnalyzer.endJob(), PhiSymmetryCalibration.endJob(), ElectronCalibration.endJob(), PrescalerFHN.endJob(), EcalPulseShapeGrapher.endJob(), EcalLaserAnalyzer2.endJob(), EcalRecHitsFilter.endJob(), SiPixelDQMRocLevelAnalyzer.endJob(), EcalLaserAnalyzer.endJob(), HitEff.endJob(), JetDeltaRTagInfoValueMapProducer< T, I >.endJob(), EcalBxOrbitNumberGrapher.endJob(), testChannel.endJob(), cms::Analyzer_minbias.endJob(), HcalLuttoDB.endJob(), TrackerGeometryCompare.endJob(), EcalURecHitHists.endJob(), ElectronCalibrationUniv.endJob(), LhcTrackAnalyzer.endJob(), EcalLaserAnalyzerYousi.endJob(), HcalRaddamMuon.endJob(), SiPixelErrorsDigisToCalibDigis.endJob(), PrimaryVertexValidation.endJob(), EcalMipGraphs.endJob(), ApeEstimatorSummary.endJob(), CosmicSplitterValidation.endJob(), TrackerToMuonPropagator.endJob(), SiPixelErrorEstimation.endJob(), CSCOverlapsTrackPreparation.endJob(), EcalDisplaysByEvent.endJob(), HcalHBHEMuonAnalyzer.endJob(), AnalyzerMinbias.endJob(), EopTreeWriter.endJob(), AlignmentMonitorAsAnalyzer.endJob(), ValidIsoTrkCalib.endJob(), IsoTrig.endJob(), EcalCosmicsHists.endJob(), TrackerTreeGenerator.endJob(), SelectedElectronFEDListProducer< TEle, TCand >.endJob(), LaserAlignment.endJob(), IsoTrackCalib.endJob(), CosmicRateAnalyzer.endJob(), analyzer::SiPixelLorentzAngle.endJob(), IsolatedGenParticles.endJob(), PCLTrackerAlProducer.endJob(), TrackerOfflineValidationSummary.endJob(), IsolatedTracksCone.endJob(), IsolatedTracksHcalScale.endJob(), IsolatedTracksNxN.endJob(), LaserSorter.endJob(), ApeEstimator.endJob(), SiPixelOfflineCalibAnalysisBase.endJob(), GlobalTrackerMuonAlignment.endJob(), AlCaHOCalibProducer.endJob(), o2o.O2ORunMgr.endJob(), TrackerOfflineValidation.endJob(), HOCalibAnalyzer.endJob(), ConditionDBWriter< T >.endJob(), ResidualRefitting.endJob(), relativeConstraints.error, info(), o2o.O2ORunMgr.startJob(), o2o.O2OJob.tag_name, XMLRBXPedestalsLoader::_loaderBaseConfig.tag_name, XMLHTRZeroSuppressionLoader::_loaderBaseConfig.tag_name, XMLProcessor::_loaderBaseConfig.tag_name, HcalChannelDataXml.tag_name, o2o.O2ORunMgr.tag_name, ElectronStudy.verbose, MuonMillepedeAlgorithm.verbose, DeviationsFromFileSensor2D.verbose, HIPAlignmentAlgorithm.verbose, o2o.O2ORunMgr.verbose, and OpticalObject.verbose.

192  def executeJob( self, args ):
193  job_name = args.name
194  command = args.executable
195  logFolder = os.getcwd()
196  if logFolderEnvVar in os.environ:
197  logFolder = os.environ[logFolderEnvVar]
198  datelabel = datetime.now().strftime("%y-%m-%d-%H-%M-%S")
199  logFileName = '%s-%s.log' %(job_name,datelabel)
200  logFile = os.path.join(logFolder,logFileName)
201  exists, enabled = self.startJob( job_name )
202  if exists is None:
203  return 3
204  if not exists:
205  O2OMgr.logger( self).error( 'The job %s is unknown.', job_name )
206  return 2
207  else:
208  if enabled == 0:
209  O2OMgr.logger( self).info( 'The job %s has been disabled.', job_name )
210  return 5
211  if args.inputFromDb:
212  try:
213  O2OMgr.logger( self ).info('Setting db input parameters...')
214  input_params = {'db':self.db_connection,'tag':self.tag_name }
215  commandTpl = string.Template( command )
216  command = commandTpl.substitute( input_params )
217  except KeyError as exc:
218  O2OMgr.logger( self).error( str(exc)+': Unknown template key in the command.' )
219  O2OMgr.logger( self ).info('O2O Command: "%s"', command )
220  try:
221  O2OMgr.logger( self ).info('Executing job %s', job_name )
222  pipe = subprocess.Popen( command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
223  out = ''
224  for line in iter(pipe.stdout.readline, ''):
225  if self.verbose:
226  sys.stdout.write(line)
227  sys.stdout.flush()
228  out += line
229  pipe.communicate()
230  O2OMgr.logger( self ).info( 'Job %s returned code: %s' %(job_name,pipe.returncode) )
231  except Exception as e:
232  O2OMgr.logger( self ).error( str(e) )
233  return 4
234  self.endJob( pipe.returncode, out )
235  with open(logFile,'a') as logF:
236  logF.write(out)
237  return pipe.returncode
238 
239 
def endJob
Definition: o2o.py:181
static const TGPicture * info(bool iBackgroundIsBlack)
db_connection
Definition: o2o.py:138
def executeJob
Definition: o2o.py:191
def startJob
Definition: o2o.py:156
def o2o.O2ORunMgr.log (   self,
  level,
  message 
)

Definition at line 140 of file o2o.py.

References o2o.O2OMgr.logger.

Referenced by conditionUploadTest.UploadTest.upload().

141  def log( self, level, message ):
142  consoleLog = getattr(O2OMgr.logger( self ),level)
143  consoleLog( message )
144  if self.logger:
145  fileLog = getattr(self.logger, level )
146  fileLog( message )
logger
Definition: o2o.py:59
def log
Definition: o2o.py:140
def o2o.O2ORunMgr.startJob (   self,
  job_name 
)

Definition at line 156 of file o2o.py.

References relativeConstraints.error, info(), o2o.O2ORun.job_name, o2o.O2ORunMgr.job_name, o2o.O2ORunMgr.start, svgfig.LineAxis.start, o2o.O2OJob.tag_name, XMLRBXPedestalsLoader::_loaderBaseConfig.tag_name, XMLHTRZeroSuppressionLoader::_loaderBaseConfig.tag_name, XMLProcessor::_loaderBaseConfig.tag_name, HcalChannelDataXml.tag_name, and o2o.O2ORunMgr.tag_name.

Referenced by o2o.O2ORunMgr.executeJob().

157  def startJob( self, job_name ):
158  O2OMgr.logger( self ).info('Checking job %s', job_name)
159  exists = None
160  enabled = None
161  try:
162  res = self.session.query(O2OJob.enabled,O2OJob.tag_name).filter_by(name=job_name)
163  for r in res:
164  exists = True
165  enabled = int(r[0])
166  self.tag_name = str(r[1])
167  if exists is None:
168  exists = False
169  enabled = False
170  if enabled:
171  self.job_name = job_name
172  self.start = datetime.now()
173  run = O2ORun(job_name=self.job_name,start_time=self.start,status_code=startStatus)
174  self.session.add(run)
175  self.session.commit()
176  except sqlalchemy.exc.SQLAlchemyError as dberror:
177  print 'Error: [%s]' %str(dberror)
178  O2OMgr.logger( self ).error( str(dberror) )
179  return exists, enabled
180 
static const TGPicture * info(bool iBackgroundIsBlack)
def startJob
Definition: o2o.py:156

Member Data Documentation

o2o.O2ORunMgr.db_connection

Definition at line 138 of file o2o.py.

Referenced by o2o.O2ORunMgr.executeJob().

o2o.O2ORunMgr.end

Definition at line 136 of file o2o.py.

Referenced by Types.LuminosityBlockRange.cppID(), Types.EventRange.cppID(), o2o.O2ORunMgr.endJob(), and cmsPerfSuite.PerfSuiteTimer.set_end().

o2o.O2ORunMgr.job_name

Definition at line 134 of file o2o.py.

Referenced by o2o.O2ORunMgr.endJob(), and o2o.O2ORunMgr.startJob().

o2o.O2ORunMgr.session

Definition at line 148 of file o2o.py.

o2o.O2ORunMgr.start

Definition at line 135 of file o2o.py.

Referenced by progressbar.ProgressBar.__next__(), Types.LuminosityBlockRange.cppID(), Types.EventRange.cppID(), o2o.O2ORunMgr.endJob(), cmsPerfSuite.PerfSuiteTimer.set_end(), cmsPerfSuite.PerfSuiteTimer.set_start(), and o2o.O2ORunMgr.startJob().

o2o.O2ORunMgr.tag_name

Definition at line 137 of file o2o.py.

Referenced by o2o.O2ORunMgr.executeJob(), and o2o.O2ORunMgr.startJob().

o2o.O2ORunMgr.verbose

Definition at line 149 of file o2o.py.

Referenced by o2o.O2ORunMgr.executeJob(), python.diff_provenance.difference.list_diff(), python.diffProv.difference.list_diff(), python.diff_provenance.difference.module_diff(), python.diffProv.difference.module_diff(), python.diff_provenance.difference.onefilemodules(), python.diffProv.difference.onefilemodules(), core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.process(), core.SkimAnalyzerCount.SkimAnalyzerCount.process(), objects.VertexAnalyzer.VertexAnalyzer.process(), and confdbOfflineConverter.OfflineConverter.query().