Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-07 02:29:35

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 import argparse
0004 import sys
0005 
0006 parser = argparse.ArgumentParser(prog=sys.argv[0], description='Test AsyncService')
0007 parser.add_argument("--earlyTermination", help="Test behavior of EarlyTermination signal on subsequent AsyncService::run() calls", action="store_true")
0008 parser.add_argument("--exception", help="Another module throws an exception while asynchronous function is running", action="store_true")
0009 args = parser.parse_args()
0010 
0011 process = cms.Process("TEST")
0012 
0013 process.maxEvents.input = 8
0014 process.options.numberOfThreads = 4
0015 process.options.numberOfStreams = 4
0016 process.source = cms.Source("EmptySource")
0017 
0018 if args.earlyTermination or args.exception:
0019     process.tester = cms.EDProducer("edmtest::AsyncServiceWaitingTester",
0020         throwingStream = cms.untracked.uint32(0)
0021     )
0022 
0023     # Make stream 0 always throw the exception in FailingProducer
0024     process.streamFilter = cms.EDFilter("edmtest::StreamIDFilter",
0025         rejectStreams = cms.vuint32(1,2,3)
0026     )
0027     process.fail = cms.EDProducer("FailingProducer")
0028     process.p2 = cms.Path(process.streamFilter+process.fail)
0029 
0030     testerService = cms.Service("edmtest::AsyncServiceTesterService")
0031     if args.earlyTermination:
0032         process.tester.waitEarlyTermination = cms.untracked.bool(True)
0033         testerService.watchEarlyTermination = cms.bool(True)
0034     elif args.exception:
0035         process.tester.waitStreamEndRun = cms.untracked.bool(True)
0036         testerService.watchStreamEndRun = cms.bool(True)
0037     process.add_(testerService)
0038 else:
0039     process.tester = cms.EDProducer("edmtest::AsyncServiceTester")
0040 
0041 process.p = cms.Path(process.tester)
0042 
0043 process.add_(cms.Service("ZombieKillerService", secondsBetweenChecks=cms.untracked.uint32(5)))