Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 import argparse
0003 import sys
0004 
0005 parser = argparse.ArgumentParser(prog=sys.argv[0], description='Test FinalPath.')
0006 
0007 parser.add_argument("--schedule", help="use cms.Schedule", action="store_true")
0008 parser.add_argument("--task", help="put EDProducer into a task", action="store_true")
0009 parser.add_argument("--path", help="put a consumer of the product onto a Path", action="store_true")
0010 parser.add_argument("--endpath", help="put a consumer of the product onto an EndPath", action="store_true")
0011 parser.add_argument("--filter", action="store_true")
0012 parser.add_argument("--tracer", help="add Tracer service", action="store_true")
0013 
0014 print(sys.argv)
0015 args = parser.parse_args()
0016 
0017 process = cms.Process("TEST")
0018 
0019 process.MessageLogger.cerr.INFO.limit = 10000
0020 
0021 process.source = cms.Source("EmptySource")
0022 
0023 process.maxEvents.input = 3
0024 
0025 process.thing = cms.EDProducer("ThingProducer")
0026 
0027 scheduledPaths =[]
0028 if args.path:
0029     print("adding Path")
0030     process.otherThing = cms.EDProducer("OtherThingProducer", thingTag = cms.InputTag("thing"))
0031     p = cms.Path()
0032     if args.filter:
0033         process.fltr = cms.EDFilter("Prescaler", prescaleFactor = cms.int32(2), prescaleOffset=cms.int32(0))
0034         p += process.fltr
0035     if not args.task:
0036         p += process.thing
0037     p += process.otherThing
0038     process.p = p
0039     scheduledPaths.append(process.p)
0040     if args.task:
0041         process.p.associate(cms.Task(process.thing))
0042 
0043 if args.endpath:
0044     print("adding EndPath")
0045     process.out2 = cms.OutputModule("AsciiOutputModule",outputCommands = cms.untracked.vstring("drop *", "keep *_thing_*_*"))
0046     process.o = cms.EndPath(process.out2)
0047     scheduledPaths.append(process.o)
0048     if args.task:
0049         process.o.associate(cms.Task(process.thing))
0050 
0051 process.out = cms.OutputModule("GetProductCheckerOutputModule", verbose= cms.untracked.bool(True), outputCommands = cms.untracked.vstring("drop *", "keep *_thing_*_*"))
0052 process.f = cms.FinalPath(process.out)
0053 
0054 if args.schedule:
0055     print("adding Schedule")
0056     scheduledPaths.append(process.f)
0057     process.schedule = cms.Schedule(*scheduledPaths)
0058     if args.task:
0059         process.schedule.associate(cms.Task(process.thing))
0060 
0061 if args.tracer:
0062     process.add_(cms.Service("Tracer"))
0063 
0064 process.options.numberOfThreads=3
0065 process.options.numberOfStreams=1