Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-10 02:51:01

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 argv = sys.argv[:]
0016 if '--' in argv:
0017     argv.remove("--")
0018 args, unknown = parser.parse_known_args(argv)
0019 
0020 
0021 process = cms.Process("TEST")
0022 
0023 process.MessageLogger.cerr.INFO.limit = 10000
0024 
0025 process.source = cms.Source("EmptySource")
0026 
0027 process.maxEvents.input = 3
0028 
0029 process.thing = cms.EDProducer("ThingProducer")
0030 
0031 scheduledPaths =[]
0032 if args.path:
0033     print("adding Path")
0034     process.otherThing = cms.EDProducer("OtherThingProducer", thingTag = cms.InputTag("thing"))
0035     p = cms.Path()
0036     if args.filter:
0037         process.fltr = cms.EDFilter("Prescaler", prescaleFactor = cms.int32(2), prescaleOffset=cms.int32(0))
0038         p += process.fltr
0039     if not args.task:
0040         p += process.thing
0041     p += process.otherThing
0042     process.p = p
0043     scheduledPaths.append(process.p)
0044     if args.task:
0045         process.p.associate(cms.Task(process.thing))
0046 
0047 if args.endpath:
0048     print("adding EndPath")
0049     process.out2 = cms.OutputModule("AsciiOutputModule",outputCommands = cms.untracked.vstring("drop *", "keep *_thing_*_*"))
0050     process.o = cms.EndPath(process.out2)
0051     scheduledPaths.append(process.o)
0052     if args.task:
0053         process.o.associate(cms.Task(process.thing))
0054 
0055 process.out = cms.OutputModule("GetProductCheckerOutputModule", verbose= cms.untracked.bool(True), outputCommands = cms.untracked.vstring("drop *", "keep *_thing_*_*"))
0056 process.f = cms.FinalPath(process.out)
0057 
0058 if args.schedule:
0059     print("adding Schedule")
0060     scheduledPaths.append(process.f)
0061     process.schedule = cms.Schedule(*scheduledPaths)
0062     if args.task:
0063         process.schedule.associate(cms.Task(process.thing))
0064 
0065 if args.tracer:
0066     process.add_(cms.Service("Tracer"))
0067 
0068 process.options.numberOfThreads=3
0069 process.options.numberOfStreams=1