Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:43

0001 import FWCore.ParameterSet.Config as cms
0002 import argparse
0003 import sys
0004 
0005 parser = argparse.ArgumentParser(prog=sys.argv[0], description='Test module transform.')
0006 
0007 #do not call transform
0008 #on Path/off Path
0009 
0010 parser.add_argument("--onPath", help="Put transform module on the Path", action="store_true")
0011 parser.add_argument("--noTransform", help="do not consume transform", action="store_true")
0012 parser.add_argument("--stream", help="use stream module", action="store_true")
0013 parser.add_argument("--noPut", help="do not put data used by transform", action="store_true")
0014 parser.add_argument("--addTracer", help="add Tracer service", action="store_true")
0015 parser.add_argument("--async_", help="use asynchronous module", action="store_true")
0016 parser.add_argument("--exception", help="Make module consumed by transformer to throw an exception", action="store_true")
0017 
0018 args = parser.parse_args()
0019 
0020 process = cms.Process("TEST")
0021 
0022 process.source = cms.Source("EmptySource")
0023 
0024 process.maxEvents.input = 4
0025 
0026 process.start = cms.EDProducer("IntProducer", ivalue = cms.int32(1))
0027 if args.exception:
0028   process.start = cms.EDProducer("FailingProducer")
0029 if args.stream:
0030   if args.async_:
0031     process.t = cms.EDProducer("TransformAsyncIntStreamProducer", get = cms.InputTag("start"), offset = cms.uint32(1), checkTransformNotCalled = cms.untracked.bool(False))
0032   else:
0033     process.t = cms.EDProducer("TransformIntStreamProducer", get = cms.InputTag("start"), offset = cms.uint32(1), checkTransformNotCalled = cms.untracked.bool(False))
0034 else:
0035   if args.async_:
0036     process.t = cms.EDProducer("TransformAsyncIntProducer", get = cms.InputTag("start"), offset = cms.uint32(1), checkTransformNotCalled = cms.untracked.bool(False), noPut = cms.bool(args.noPut))
0037   else:
0038     process.t = cms.EDProducer("TransformIntProducer", get = cms.InputTag("start"), offset = cms.uint32(1), checkTransformNotCalled = cms.untracked.bool(False), noPut = cms.bool(args.noPut))
0039 
0040 process.tester = cms.EDAnalyzer("IntTestAnalyzer",
0041                                 moduleLabel = cms.untracked.InputTag("t","transform"),
0042                                 valueMustMatch = cms.untracked.int32(3))
0043 
0044 if args.noTransform:
0045     process.tester.moduleLabel = "t"
0046     process.tester.valueMustMatch = 2
0047     process.t.checkTransformNotCalled = True
0048 
0049 process.nonConsumed = process.t.clone()
0050 
0051 if args.onPath:
0052     process.p = cms.Path(process.t+process.tester, cms.Task(process.start, process.nonConsumed))
0053 else:
0054     process.p = cms.Path(process.tester, cms.Task(process.start, process.t, process.nonConsumed))
0055 
0056 if args.addTracer:
0057     process.add_(cms.Service("Tracer"))