|
| 1 | +import FWCore.ParameterSet.Config as cms |
| 2 | +import argparse |
| 3 | + |
| 4 | +parser = argparse.ArgumentParser(description='Test reduced ProcessHistory') |
| 5 | +parser.add_argument("--input", type=str, help="Input file") |
| 6 | +parser.add_argument("--bypassVersionCheck", action="store_true", help="Bypass version check") |
| 7 | +parser.add_argument("--expectNewRun", action="store_true", help="Set this if a new run is expected between the original files") |
| 8 | + |
| 9 | +args = parser.parse_args() |
| 10 | + |
| 11 | +process = cms.Process("READ") |
| 12 | + |
| 13 | +from IOPool.Input.modules import PoolSource |
| 14 | +process.source = PoolSource( |
| 15 | + fileNames = [f"file:{args.input}"], |
| 16 | + bypassVersionCheck = args.bypassVersionCheck, |
| 17 | +) |
| 18 | + |
| 19 | +from FWCore.Framework.modules import TestMergeResults, RunLumiEventAnalyzer |
| 20 | +process.testmerge = TestMergeResults( |
| 21 | + expectedBeginRunProd = [10001, 20004, 10003], # should be only one run |
| 22 | + expectedEndRunProd = [100001, 200004, 100003], |
| 23 | + expectedBeginLumiProd = [101, 102, 103, |
| 24 | + 101, 102, 103], |
| 25 | + expectedEndLumiProd = [1001, 1002, 1003, |
| 26 | + 1001, 1002, 1003], |
| 27 | + |
| 28 | + expectedBeginRunNew = [10001, 10002, 10003], # should be only one run |
| 29 | + expectedEndRunNew = [100001, 100002, 100003], |
| 30 | + expectedBeginLumiNew = [101, 102, 103, |
| 31 | + 101, 102, 103], |
| 32 | + expectedEndLumiNew = [1001, 1002, 1003, |
| 33 | + 1001, 1002, 1003], |
| 34 | + expectedProcessHistoryInRuns = [ |
| 35 | + 'PROD', |
| 36 | + 'MERGETWOFILES', |
| 37 | + 'READ' |
| 38 | + ] |
| 39 | +) |
| 40 | +if args.expectNewRun: |
| 41 | + process.testmerge.expectedBeginRunProd[1] = 10002 |
| 42 | + process.testmerge.expectedEndRunProd[1] = 100002 |
| 43 | + |
| 44 | +process.test = RunLumiEventAnalyzer( |
| 45 | + expectedRunLumiEvents = [ |
| 46 | + 1, 0, 0, # beginRun |
| 47 | + 1, 1, 0, # beginLumi |
| 48 | + 1, 1, 1, |
| 49 | + 1, 1, 2, |
| 50 | + 1, 1, 3, |
| 51 | + 1, 1, 4, |
| 52 | + 1, 1, 5, |
| 53 | + 1, 1, 6, |
| 54 | + 1, 1, 7, |
| 55 | + 1, 1, 8, |
| 56 | + 1, 1, 9, |
| 57 | + 1, 1, 10, |
| 58 | + 1, 1, 0, # endLumi |
| 59 | + 1, 2, 0, # beginLumi |
| 60 | + 1, 2, 1, |
| 61 | + 1, 2, 2, |
| 62 | + 1, 2, 3, |
| 63 | + 1, 2, 4, |
| 64 | + 1, 2, 5, |
| 65 | + 1, 2, 6, |
| 66 | + 1, 2, 7, |
| 67 | + 1, 2, 8, |
| 68 | + 1, 2, 9, |
| 69 | + 1, 2, 10, |
| 70 | + 1, 2, 0, # endLumi |
| 71 | + 1, 0, 0, # endRun |
| 72 | + ] |
| 73 | +) |
| 74 | +if args.expectNewRun: |
| 75 | + # Insert endRun+beginRun to the expected transition sequence |
| 76 | + endLumiIndex = 3*(10+3) |
| 77 | + process.test.expectedRunLumiEvents = process.test.expectedRunLumiEvents[:endLumiIndex] + [ |
| 78 | + 1, 0, 0, # endRun |
| 79 | + 1, 0, 0, # beginRun |
| 80 | + 1, 3, 0, # beginLumi |
| 81 | + 1, 3, 1, |
| 82 | + 1, 3, 2, |
| 83 | + 1, 3, 3, |
| 84 | + 1, 3, 4, |
| 85 | + 1, 3, 5, |
| 86 | + 1, 3, 6, |
| 87 | + 1, 3, 7, |
| 88 | + 1, 3, 8, |
| 89 | + 1, 3, 9, |
| 90 | + 1, 3, 10, |
| 91 | + 1, 3, 0, # endLumi |
| 92 | + 1, 0, 0, # endRun |
| 93 | + ] |
| 94 | + |
| 95 | +process.p = cms.Path( |
| 96 | + process.testmerge + |
| 97 | + process.test |
| 98 | +) |
0 commit comments