File indexing completed on 2024-04-06 12:12:30
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 ConditionalTasks.')
0007
0008 parser.add_argument("--filterSucceeds", help="Have filter succeed", action="store_true")
0009 parser.add_argument("--testView", help="Get data via a view", action="store_true")
0010
0011 args = parser.parse_args()
0012
0013 process = cms.Process("Test")
0014
0015 process.source = cms.Source("EmptySource")
0016
0017
0018 process.maxEvents.input = 4
0019 process.options.numberOfThreads = 4
0020
0021 process.MessageLogger.files.conditionaltasks_nonconsumed = dict()
0022 process.MessageLogger.files.conditionaltasks_nonconsumed.default = dict(limit=0)
0023 process.MessageLogger.files.conditionaltasks_nonconsumed.NonConsumedConditionalModules = dict(limit=100)
0024
0025 process.a = cms.EDProducer("IntProducer", ivalue = cms.int32(1))
0026 process.b = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("a")))
0027
0028 process.f1 = cms.EDFilter("IntProductFilter", label = cms.InputTag("b"))
0029
0030 process.c = cms.EDProducer("IntProducer", ivalue = cms.int32(2))
0031 process.d = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("c")))
0032 process.e = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("d")))
0033
0034 process.nonconsumed = process.a.clone()
0035 process.nonconsumed2 = process.b.clone(
0036 labels = ["nonconsumed"]
0037 )
0038 process.nonconsumedConditionalTask = cms.ConditionalTask(
0039 process.nonconsumed,
0040 process.nonconsumed2,
0041 )
0042
0043 process.consumedInOnePath = process.a.clone()
0044 process.nonconsumedConditionalTask2 = cms.ConditionalTask(
0045 process.nonconsumed,
0046 process.consumedInOnePath
0047 )
0048
0049 process.explicitlyInDifferentPath = process.a.clone()
0050 process.consumedInUnrelatedPath = process.a.clone()
0051 process.nonconsumedConditionalTask3 = cms.ConditionalTask(
0052 process.nonconsumed,
0053 process.explicitlyInDifferentPath,
0054 process.consumedInUnrelatedPath
0055 )
0056 process.nonconsumedTask3 = cms.Task(
0057 process.consumedInUnrelatedPath
0058 )
0059
0060 process.prodOnPath = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("d"), cms.InputTag("e")))
0061 process.prodOnPath2 = process.prodOnPath.clone(
0062 labels = ["consumedInOnePath"]
0063 )
0064 process.prodOnPath3 = process.prodOnPath.clone(
0065 labels = ["consumedInUnrelatedPath"]
0066 )
0067
0068 if args.filterSucceeds:
0069 threshold = 1
0070 else:
0071 threshold = 3
0072
0073 process.f2 = cms.EDFilter("IntProductFilter", label = cms.InputTag("e"), threshold = cms.int32(threshold))
0074
0075 if args.testView:
0076 process.f3 = cms.EDAnalyzer("SimpleViewAnalyzer",
0077 label = cms.untracked.InputTag("f"),
0078 sizeMustMatch = cms.untracked.uint32(10),
0079 checkSize = cms.untracked.bool(False)
0080 )
0081 process.f = cms.EDProducer("OVSimpleProducer", size = cms.int32(10))
0082 producttype = "edmtestSimplesOwned"
0083 else:
0084 process.f= cms.EDProducer("IntProducer", ivalue = cms.int32(3))
0085 process.f3 = cms.EDFilter("IntProductFilter", label = cms.InputTag("f"))
0086 producttype = "edmtestIntProduct"
0087
0088 process.p = cms.Path(process.f1+process.prodOnPath+process.f2+process.f3, cms.ConditionalTask(process.a, process.b, process.c, process.d, process.e, process.f, process.nonconsumedConditionalTask, process.nonconsumedConditionalTask2))
0089
0090 process.p2 = cms.Path(process.prodOnPath2, process.nonconsumedConditionalTask2, process.nonconsumedConditionalTask3)
0091
0092 process.p3 = cms.Path(process.explicitlyInDifferentPath)
0093
0094 process.p4 = cms.Path(process.prodOnPath3, process.nonconsumedTask3)
0095
0096 process.tst = cms.EDAnalyzer("IntTestAnalyzer", moduleLabel = cms.untracked.InputTag("f"), valueMustMatch = cms.untracked.int32(3),
0097 valueMustBeMissing = cms.untracked.bool(not args.filterSucceeds))
0098
0099 process.nonconsumedConsumer = cms.EDProducer("AddIntsProducer", labels = cms.VInputTag(cms.InputTag("nonconsumed")))
0100
0101 process.endp = cms.EndPath(process.tst+process.nonconsumedConsumer)