1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# Test the what happens after an exception associated
# with the behavior SkipEvent
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
# We are testing the SkipEvent behavior.
process.options.SkipEvent = 'EventCorruption'
process.maxEvents.input = 3
from FWCore.Modules.import EmptySource
process.source = EmptySource(
firstLuminosityBlock = 1,
numberEventsInLuminosityBlock = 100,
firstEvent = 1,
firstRun = 1,
numberEventsInRun = 100
)
process.testThrow = cms.EDAnalyzer("TestFailuresAnalyzer",
whichFailure = cms.int32(5),
eventToThrow = cms.untracked.uint64(2)
)
from FWCore.Framework.modules import RunLumiEventAnalyzer, IntProducer, IntConsumingAnalyzer
# In the path before the module throwing an exception all 3 events should run
process.beforeException = RunLumiEventAnalyzer(
verbose = True,
expectedRunLumiEvents = [
1, 0, 0,
1, 1, 0,
1, 1, 1,
1, 1, 2,
1, 1, 3,
1, 1, 0,
1, 0, 0
]
)
# Note that this one checks that the second event was skipped
process.afterException = RunLumiEventAnalyzer(
verbose = True,
expectedRunLumiEvents = [
1, 0, 0,
1, 1, 0,
1, 1, 1,
1, 1, 3,
1, 1, 0,
1, 0, 0
]
)
process.onEndPath = RunLumiEventAnalyzer(
verbose = True,
expectedRunLumiEvents = [
1, 0, 0,
1, 1, 0,
1, 1, 1,
1, 1, 2,
1, 1, 3,
1, 1, 0,
1, 0, 0
],
dumpTriggerResults = True
)
# The next two modules are not really necessary for the test
# Just adding in a producer and filter to make it more realistic
# No particular reason that I selected these two modules
from FWCore.Integration.modules import ThingWithMergeProducer
process.thingWithMergeProducer = ThingWithMergeProducer()
process.p1Done = IntProducer(ivalue = 1)
process.waitTillP1Done = IntConsumingAnalyzer(getFromModule = "p1Done")
process.f1 = cms.EDFilter("TestFilterModule",
acceptValue = cms.untracked.int32(98),
onlyOne = cms.untracked.bool(False)
)
from IOPool.Output.modules import PoolOutputModule
process.out = PoolOutputModule(
fileName = 'testSkipEvent.root',
SelectEvents = dict(SelectEvents = ['p1'])
)
process.p1 = cms.Path(process.beforeException *
process.testThrow *
process.afterException *
process.thingWithMergeProducer *
process.f1+process.p1Done)
process.p2 = cms.Path(process.waitTillP1Done+process.afterException)
process.e = cms.EndPath(process.out * process.onEndPath)
|