Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-14 02:38:45

0001 # Test the what happens after an exception associated
0002 # with the behavior SkipEvent
0003 
0004 import FWCore.ParameterSet.Config as cms
0005 
0006 process = cms.Process("TEST")
0007 
0008 # We are testing the SkipEvent behavior.
0009 process.options.SkipEvent = 'EventCorruption'
0010 
0011 process.maxEvents.input = 3
0012 
0013 from FWCore.Modules.import EmptySource
0014 process.source = EmptySource(
0015     firstLuminosityBlock = 1,
0016     numberEventsInLuminosityBlock = 100,
0017     firstEvent = 1,
0018     firstRun = 1,
0019     numberEventsInRun = 100
0020 )
0021 
0022 process.testThrow = cms.EDAnalyzer("TestFailuresAnalyzer",
0023     whichFailure = cms.int32(5),
0024     eventToThrow = cms.untracked.uint64(2)
0025 )
0026 
0027 from FWCore.Framework.modules import RunLumiEventAnalyzer, IntProducer, IntConsumingAnalyzer
0028 # In the path before the module throwing an exception all 3 events should run
0029 process.beforeException = RunLumiEventAnalyzer(
0030     verbose = True,
0031     expectedRunLumiEvents = [
0032         1, 0, 0,
0033         1, 1, 0,
0034         1, 1, 1,
0035         1, 1, 2,
0036         1, 1, 3,
0037         1, 1, 0,
0038         1, 0, 0
0039      ]
0040 )
0041 
0042 # Note that this one checks that the second event was skipped
0043 process.afterException = RunLumiEventAnalyzer(
0044     verbose = True,
0045     expectedRunLumiEvents = [
0046         1, 0, 0,
0047         1, 1, 0,
0048         1, 1, 1,
0049         1, 1, 3,
0050         1, 1, 0,
0051         1, 0, 0
0052      ]
0053 )
0054 
0055 process.onEndPath = RunLumiEventAnalyzer(
0056     verbose = True,
0057     expectedRunLumiEvents = [
0058         1, 0, 0,
0059         1, 1, 0,
0060         1, 1, 1,
0061         1, 1, 2,
0062         1, 1, 3,
0063         1, 1, 0,
0064         1, 0, 0
0065      ],
0066      dumpTriggerResults = True
0067 )
0068 
0069 # The next two modules are not really necessary for the test
0070 # Just adding in a producer and filter to make it more realistic
0071 # No particular reason that I selected these two modules
0072 from FWCore.Integration.modules import ThingWithMergeProducer
0073 process.thingWithMergeProducer = ThingWithMergeProducer()
0074 
0075 process.p1Done = IntProducer(ivalue = 1)
0076 process.waitTillP1Done = IntConsumingAnalyzer(getFromModule = "p1Done")
0077 
0078 
0079 process.f1 = cms.EDFilter("TestFilterModule",
0080     acceptValue = cms.untracked.int32(98),
0081     onlyOne = cms.untracked.bool(False)
0082 )
0083 
0084 from IOPool.Output.modules import PoolOutputModule
0085 process.out = PoolOutputModule(
0086     fileName = 'testSkipEvent.root',
0087     SelectEvents = dict(SelectEvents = ['p1'])
0088 )
0089 
0090 process.p1 = cms.Path(process.beforeException *
0091                       process.testThrow *
0092                       process.afterException *
0093                       process.thingWithMergeProducer *
0094                       process.f1+process.p1Done)
0095 
0096 process.p2 = cms.Path(process.waitTillP1Done+process.afterException)
0097 
0098 process.e = cms.EndPath(process.out * process.onEndPath)