File indexing completed on 2023-03-17 11:03:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 import FWCore.ParameterSet.Config as cms
0011
0012 nStreams = 4
0013 nRuns = 17
0014 nLumisPerRun = 1
0015 nEventsPerLumi = 6
0016
0017 nEventsPerRun = nLumisPerRun*nEventsPerLumi
0018 nLumis = nRuns*nLumisPerRun
0019 nEvents = nRuns*nEventsPerRun
0020
0021 process = cms.Process("TEST")
0022
0023 from FWCore.ParameterSet.VarParsing import VarParsing
0024
0025 options = VarParsing()
0026
0027 options.register("testNumber", 0,
0028 VarParsing.multiplicity.singleton,
0029 VarParsing.varType.int,
0030 "Test number")
0031
0032 options.parseArguments()
0033
0034 process.source = cms.Source("EmptySource",
0035 firstRun = cms.untracked.uint32(1),
0036 firstLuminosityBlock = cms.untracked.uint32(1),
0037 firstEvent = cms.untracked.uint32(1),
0038 numberEventsInLuminosityBlock = cms.untracked.uint32(nEventsPerLumi),
0039 numberEventsInRun = cms.untracked.uint32(nEventsPerRun)
0040 )
0041
0042 process.maxEvents = cms.untracked.PSet(
0043 input = cms.untracked.int32(nEvents)
0044 )
0045
0046 process.options = cms.untracked.PSet(
0047 numberOfThreads = cms.untracked.uint32(4),
0048 numberOfStreams = cms.untracked.uint32(nStreams),
0049 numberOfConcurrentRuns = cms.untracked.uint32(4),
0050 numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(4)
0051 )
0052
0053 process.busy1 = cms.EDProducer("BusyWaitIntProducer",ivalue = cms.int32(1), iterations = cms.uint32(10*1000*1000))
0054
0055 process.throwException = cms.EDProducer("ExceptionThrowingProducer")
0056
0057
0058 print('testNumber', options.testNumber)
0059
0060
0061
0062
0063
0064 if options.testNumber == 1:
0065 process.throwException.eventIDThrowOnEvent = cms.untracked.EventID(3, 1, 5)
0066 elif options.testNumber == 2:
0067 process.throwException.eventIDThrowOnGlobalBeginRun = cms.untracked.EventID(4, 0, 0)
0068 elif options.testNumber == 3:
0069 process.throwException.eventIDThrowOnGlobalBeginLumi = cms.untracked.EventID(4, 1, 0)
0070 elif options.testNumber == 4:
0071 process.throwException.eventIDThrowOnGlobalEndRun = cms.untracked.EventID(3, 0, 0)
0072 elif options.testNumber == 5:
0073 process.throwException.eventIDThrowOnGlobalEndLumi = cms.untracked.EventID(3, 1, 0)
0074 elif options.testNumber == 6:
0075 process.throwException.eventIDThrowOnStreamBeginRun = cms.untracked.EventID(4, 0, 0)
0076 elif options.testNumber == 7:
0077 process.throwException.eventIDThrowOnStreamBeginLumi = cms.untracked.EventID(4, 1, 0)
0078 elif options.testNumber == 8:
0079 process.throwException.eventIDThrowOnStreamEndRun = cms.untracked.EventID(3, 0, 0)
0080 elif options.testNumber == 9:
0081 process.throwException.eventIDThrowOnStreamEndLumi = cms.untracked.EventID(3, 1, 0)
0082 else:
0083 print("The parameter named testNumber is out of range. An exception will not be thrown. Supported values range from 1 to 9.")
0084 print("The proper syntax for setting the parameter is:")
0085 print("")
0086 print (" cmsRun FWCore/Integration/test/testFrameworkExceptionHandling_cfg.py testNumber=1")
0087 print("")
0088 process.path1 = cms.Path(
0089 process.busy1 *
0090 process.throwException
0091 )