CMS 3D CMS Logo

Classes | Functions | Variables
watchdog Namespace Reference

Classes

class  Timeout
 

Functions

def alarm_handler (signum, frame)
 
def launch (args)
 
def log (s)
 
def main (args)
 

Variables

 action
 
 args
 
 const
 
 default
 
 description
 
 dest
 
 False
 
 group
 
 help
 
 int
 
 nargs
 
 parser
 
 SIGTERM
 
 stdin_
 
 stdout_
 
 type
 

Function Documentation

def watchdog.alarm_handler (   signum,
  frame 
)

Definition at line 15 of file watchdog.py.

15 def alarm_handler(signum, frame):
16  if signum != 14: return
17  raise Timeout("Timeout reached.")
18 
19 signal.signal(signal.SIGALRM, alarm_handler)
20 
def alarm_handler(signum, frame)
Definition: watchdog.py:15
def watchdog.launch (   args)

Definition at line 25 of file watchdog.py.

References log(), and str.

Referenced by main().

25 def launch(args):
26  fd, wd = os.pipe()
27 
28  def preexec():
29  os.close(fd)
30 
31  env = os.environ
32  env["WATCHDOG_FD"] = str(wd)
33 
34  p = subprocess.Popen(args.pargs, preexec_fn=preexec, stdin=stdin_, stdout=stdout_)
35  os.close(wd)
36 
37  while True:
38  try:
39  signal.alarm(args.t)
40  ch = os.read(fd, 1024)
41  signal.alarm(0)
42 
43  if not ch:
44  os.close(fd)
45  return False, p.wait() # normal exit
46 
47  log("Received: %s, timer reset." % repr(ch))
48 
49  except Timeout as t:
50  signal.alarm(0)
51 
52  log("Timeout reached, taking action.")
53 
54  if p.poll() is None:
55  p.send_signal(args.action)
56 
57  os.close(fd)
58  return True, p.wait()
59 
60  for p in open_procs_:
61  if p.poll() is None:
62  p.send_signal(sig)
63 
def log(s)
Definition: watchdog.py:21
def launch(args)
Definition: watchdog.py:25
#define str(s)
def watchdog.log (   s)

Definition at line 21 of file watchdog.py.

Referenced by launch(), and main().

21 def log(s):
22  sys.stderr.write("watchdog: " + s + "\n");
23  sys.stderr.flush()
24 
def log(s)
Definition: watchdog.py:21
def watchdog.main (   args)

Definition at line 64 of file watchdog.py.

References launch(), and log().

64 def main(args):
65  while True:
66  killed, ret = launch(args)
67  log("Program exitted, killed: %s, code: %d." % (killed, ret, ))
68 
69  if killed and args.restart:
70  log("Restarting.")
71  continue
72 
73  break
74 
75 
def log(s)
Definition: watchdog.py:21
def main(args)
Definition: watchdog.py:64
def launch(args)
Definition: watchdog.py:25

Variable Documentation

watchdog.action

Definition at line 79 of file watchdog.py.

watchdog.args

Definition at line 87 of file watchdog.py.

watchdog.const

Definition at line 83 of file watchdog.py.

Referenced by TkGluedMeasurementDet::HitCollectorForRecHits.addProjected(), TkGluedMeasurementDet::HitCollectorForSimpleHits.addProjected(), TkGluedMeasurementDet::HitCollectorForFastMeasurements.addProjected(), cms.Adler32(), edm::soa::impl::ConstTableItrAdvance< I, Args >.advance(), edm::soa::impl::ConstTableItrAdvance< 0, Args... >.advance(), SiStripGainFromData.algoBeginJob(), ecaldqm::RecoSummaryTask.analyze(), ecaldqm::ClusterTask.analyze(), B2GDQM.analyzeJets(), PFElecTkProducer.applySelection(), JetTracksAssociationXtrpCalo.associateInputTracksToJet(), BaseTrackerRecHit.BaseTrackerRecHit(), edm::SoATuple< edm::EDConsumerBase::TokenLookupInfo, bool, edm::EDConsumerBase::LabelPlacement, edm::KindOfType >.begin(), SiStripDetInfoFileWriter.beginRun(), BoundDiskSector.bounds(), BarrelDetLayer.bounds(), ForwardDetLayer.bounds(), RPCConeBuilder.buildCones(), TrackProducerAlgorithm< reco::Track >.buildTrack(), GroupedCkfTrajectoryBuilder.buildTrajectories(), DAFTrackProducerAlgorithm.calculateNdof(), edm.checkClassDictionaries(), edm::soa::TableView< Args >.column(), edm.convert_handle(), edm.convert_handle_check_type(), L1JPTOffsetCorrector.correction(), L1JPTOffsetCorrectorImpl.correction(), DAFTrackProducerAlgorithm.countingGoodHits(), PFCTRecHitProducer.createHcalRecHit(), BareRootProductGetter.createNewBuffer(), edm::ProductResolverBase::Resolution.data(), edm::reftobase::RefVectorHolder< REFV >::const_iterator_imp_specific.dc(), PATTauDiscriminationAgainstElectronMVA6.discriminate(), CaloTowersCreationAlgo.ecalChanStatusForCaloTower(), edm::SoATuple< edm::EDConsumerBase::TokenLookupInfo, bool, edm::EDConsumerBase::LabelPlacement, edm::KindOfType >.end(), MRHChi2MeasurementEstimator.estimate(), pat::JetCorrFactorsProducer.evaluate(), edm::EventForOutput.eventPrincipal(), edm::Event.eventPrincipal(), edm::soa::TableView< Args >.fillArray(), cms::PileupJPTJetIdAlgo.fillJPTBlock(), edm::FilterWrapper< T >.filter(), DAFTrackProducerAlgorithm.filter(), SiStripDigitizer.finalizeEvent(), ElectronMVAEstimatorRun2.findCategory(), PFElecTkProducer.FindPfRef(), SiTrackerMultiRecHit.firstClusterRef(), edm::test::Event.get(), edm::soa::RowView< Args >.get(), edm::soa::MutableRowView< Args >.get(), edm::eventsetup::DependentRecordImplementation< EcalLaserDbRecord, boost::mpl::vector< EcalLaserAlphasRcd, EcalLaserAPDPNRatiosRefRcd, EcalLaserAPDPNRatiosRcd, EcalLinearCorrectionsRcd > >.get(), edm::SoATuple< edm::EDConsumerBase::TokenLookupInfo, bool, edm::EDConsumerBase::LabelPlacement, edm::KindOfType >.get(), edm::soa::Table< Args >.get(), TrajAnnealing.getAnnealingWeight(), fwlite::LuminosityBlockBase.getByLabelImpl(), fwlite::RunBase.getByLabelImpl(), fwlite::EventBase.getByLabelImpl(), ECFAdder.getECF(), edm::eventsetup::EventSetupRecordImpl.getImplementation(), BareRootProductGetter.getIt(), edm.getProduct(), edm::refcore.getProduct_(), edm::refcore.getProductWithCoreFromRef_(), edm::reftobase::RefHolderBase.getPtr(), edm::refitem::GetRefPtrImpl< C, T, F, KEY >.getRefPtr_(), edm::refitem::GetRefPtrImpl< C, T, F, unsigned int >.getRefPtr_(), fwlite::DataGetterHelper.getThinnedAssociation(), BareRootProductGetter.getThinnedAssociation(), edm::EventPrincipal.getThinnedAssociation(), edm::refcore.getThinnedProduct_(), GlobalCosmicMuonTrajectoryBuilder.getTransientRecHits(), TrackTransformer.getTransientRecHits(), GlobalTrajectoryBuilderBase.getTransientRecHits(), CosmicHitPairGeneratorFromLayerPair.hitPairs(), RectangularEtaPhiTrackingRegion.hits(), MultiHitGeneratorFromChi2.hitSets(), PFHFRecHitCreator.importRecHits(), CosmicLayerTriplets.init(), SiStripDetVOffFakeBuilder.initialize(), PreMixingSiStripWorker.initializeEvent(), SiStripDigitizer.initializeEvent(), edm::reftobase::Holder< T, REF >.isEqualTo(), edm::reftobase::IndirectHolder< T >.isEqualTo(), edm::Wrapper< T >.isProductEqual_(), PFElecTkProducer.isSameEgSC(), PFElecTkProducer.isSharingEcalEnergyWithEgSC(), edm::RefToBase< T >.key(), MuonTrackLoader.loadTracks(), LowPtGsfElectronSeedProducer.loop(), edm::LuminosityBlockForOutput.luminosityBlockPrincipal(), edm::LuminosityBlock.luminosityBlockPrincipal(), edm::WorkerMaker< T >.makeWorker(), TkPixelMeasurementDet.measurements(), edm::Wrapper< T >.mergeProduct_(), AntiElectronIDMVA6.MVAValue(), edm::Ptr< T >.operator*(), edm::Ptr< T >.operator->(), reco.operator<<(), edm::Guid.operator=(), edm::Guid.operator==(), edm.pointerToBase(), edm::TypeWithDict.pointerToBaseType(), edm::PoolOutputModule.preActionBeforeRunEventAsync(), edm::UnscheduledProductResolver.prefetchAsync_(), edm::ProductSelector.print(), DeDxDiscriminatorLearner.processHit(), StandaloneTrackMonitor.processHit(), HSCPDeDxInfoProducer.processHit(), DeDxHitInfoProducer.processHit(), DeDxEstimatorProducer.processHit(), FastTrackDeDxProducer.processHit(), JetTracksAssociationExplicit.produce(), SiStripHashedDetIdESModule.produce(), JetTracksAssociatorAtCaloFace.produce(), PFTrackProducer.produce(), HSCPDeDxInfoProducer.produce(), TrackerCleaner< T >.produce(), OnlineMetaDataRawToDigi.produce(), TkMSParameterizationBuilder.produce(), PFElecTkProducer.produce(), MkFitOutputConverter.produce(), GoodSeedProducer.produce(), SiStripRegionConnectivity.produceRegionCabling(), edm::OrphanHandle< T >.product(), edm::TestHandle< T >.product(), edm::Handle< T >.product(), edm::ESTransientHandle< T >.product(), edm::ESHandle< MTDDetLayerGeometry >.product(), edm::refcoreimpl.productGetter(), edm::refcoreimpl.productPtr(), TrackingRecHitPropagator.project(), TkGluedMeasurementDet.projectOnGluedDet(), edm::reftobase::RefVectorHolder< REFV >.push_back(), edm::PtrVector< reco::reco::PFCluster >.push_back(), FedRawDataInputSource.read(), GroupedCkfTrajectoryBuilder.rebuildSeedingRegion(), TkPhase2OTMeasurementDet.recHits(), RecHitsSortedInPhi.RecHitsSortedInPhi(), edm::Ref< C, T, F >.Ref(), GlobalMuonRefitter.refit(), PFElecTkProducer.resolveGsfTracks(), edm::UnscheduledProductResolver.resolveProduct_(), SimpleDAFHitCollector.rightdimension(), run_script(), edm::RunForOutput.runPrincipal(), edm::Run.runPrincipal(), edm::refcoreimpl.setCacheIsProductGetter(), FRDStreamSource.setRunAndEventInfo(), GlobalMuonRefitter.setServices(), TrackTransformer.setServices(), SimpleDAFHitCollector.SimpleDAFHitCollector(), SiTrackerMultiRecHitUpdator.SiTrackerMultiRecHitUpdator(), TkStackMeasurementDet.specificGeomDet(), TkGluedMeasurementDet.specificGeomDet(), TkPhase2OTMeasurementDet.specificGeomDet(), TkPixelMeasurementDet.specificGeomDet(), TkStripMeasurementDet.specificGeomDet(), reco::PFCandidate.storeRefInfo(), TCDSRecord.TCDSRecord(), TrajAnnealing.TrajAnnealing(), edm::refcore.tryToGetProductWithCoreFromRef_(), L1GtfeExtWord.unpack(), L1GtfeWord.unpack(), L1TcsWord.unpack(), L1GtFdlWord.unpack(), fwlite::DataGetterHelper.wrapperBasePtr(), VirtualJetProducer.writeJets(), HitPairGeneratorFromLayerPair.~HitPairGeneratorFromLayerPair(), and MuonTrackLoader.~MuonTrackLoader().

watchdog.default

Definition at line 77 of file watchdog.py.

watchdog.description

Definition at line 76 of file watchdog.py.

watchdog.dest

Definition at line 83 of file watchdog.py.

watchdog.False

Definition at line 79 of file watchdog.py.

watchdog.group

Definition at line 82 of file watchdog.py.

Referenced by alignment.Alignment.__getConditions(), L1MuDTTrackAssembler.address(), L1MuBMTrackAssembler.address(), MuonPFAnalyzer.analyze(), FastTimerService::PlotsPerJob.book(), MuonPFAnalyzer.bookHistos(), CSCWireTopology.channel(), EcalShowerContainmentCorrections.correctionCoefficients(), EcalShowerContainmentCorrections.correctionXY(), SimG4HcalValidation.fetchHits(), FastTimerService::PlotsPerJob.fill(), HcalTB04Analysis.fillBuffer(), EcalShowerContainmentCorrections.fillCorrectionCoefficients(), HcalTB04Analysis.fillEvent(), HcalTestHistoClass.fillHits(), HcalTB04Analysis.finalAnalysis(), utils.get_relval_id(), contentValuesLib.getDatasetName(), HcalTBNumberingScheme.getUnitID(), SimpleNavigationSchool.linkForwardLayers(), GenObject.GenObject.loadConfigFile(), NanoAODDQM.NanoAODDQM(), L1CaloEcalScaleConfigOnlineProd.newObject(), MeasurementByLayerGrouper.operator()(), FastTimerService.postBeginJob(), FastTimerService.postEvent(), FastTimerService.printEvent(), FastTimerService.printSummary(), PixelTemplateSmearerBase.process(), HcalTTPDigiProducer.produce(), HcalTestAnalysis.qieAnalysis(), EcalWeightGroupXMLTranslator.readXML(), TauDiscriminatorTools.recoTauTypeMapper(), hippyaddtobaddatafiles.runcfg(), L1MuDTTrackAssembler.runEncoderSubUnit1(), L1MuBMTrackAssembler.runEncoderSubUnit1(), L1MuBMTrackAssembler.runEncoderSubUnit2(), L1MuDTTrackAssembler.runEncoderSubUnit2(), jsoncollector::DataPointDefinition.setDefaultGroup(), TrackingMaterialAnalyser.split(), LA_Filler_Fitter.summarize_ensembles(), and HcalTB04Analysis.unitID().

watchdog.help

Definition at line 77 of file watchdog.py.

watchdog.int

Definition at line 77 of file watchdog.py.

watchdog.nargs

Definition at line 80 of file watchdog.py.

watchdog.parser

Definition at line 76 of file watchdog.py.

watchdog.SIGTERM
watchdog.stdin_

Definition at line 7 of file watchdog.py.

watchdog.stdout_

Definition at line 8 of file watchdog.py.

watchdog.type

Definition at line 77 of file watchdog.py.