-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new test for reduced ProcessHistory using mocked CMSSW release …
…version The existing test relies on old (4_2_X-time) files.
- Loading branch information
Showing
7 changed files
with
215 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
function die { echo $1: status $2 ; exit $2; } | ||
|
||
VERSION_ARR=(${CMSSW_VERSION//_/ }) | ||
VERSION1="${VERSION_ARR[0]}_${VERSION_ARR[1]}_${VERSION_ARR[2]}_0" | ||
VERSION2="${VERSION_ARR[0]}_${VERSION_ARR[1]}_${VERSION_ARR[2]}_1" | ||
VERSION3="${VERSION_ARR[0]}_${VERSION_ARR[1]}_$((${VERSION_ARR[2]}+1))_0" | ||
|
||
# Check that changing the patch version does not lead to new run | ||
cmsRun ${SCRAM_TEST_PATH}/testReducedProcessHistoryCreate_cfg.py --version ${VERSION1} --lumi 1 --output version1.root || die "testReducedProcessHistoryCreate_cfg.py --version ${VERSION1} failed" $? | ||
cmsRun ${SCRAM_TEST_PATH}/testReducedProcessHistoryCreate_cfg.py --version ${VERSION2} --lumi 2 --output version2.root || die "testReducedProcessHistoryCreate_cfg.py --version ${VERSION2} failed" $? | ||
|
||
edmProvDump version1.root | grep -q "PROD.*'${VERSION1}'" || die "Did not find ${VERSION1} from version.root provenance" $? | ||
edmProvDump version2.root | grep -q "PROD.*'${VERSION2}'" || die "Did not find ${VERSION2} from version.root provenance" $? | ||
|
||
cmsRun ${SCRAM_TEST_PATH}/test_merge_two_files.py version1.root version2.root || die "Merge version1.root version2.root failed" $? | ||
|
||
cmsRun ${SCRAM_TEST_PATH}/testReducedProcessHistory_cfg.py --input merged_files.root || die "testReducedProcessHistory_cfg.py merged_files.root failed" $? | ||
|
||
|
||
# Check that changing the minor version leads to new run | ||
cmsRun ${SCRAM_TEST_PATH}/testReducedProcessHistoryCreate_cfg.py --version ${VERSION3} --lumi 3 --output version3.root || die "testReducedProcessHistoryCreate_cfg.py --version ${VERSION3} failed" $? | ||
|
||
edmProvDump version3.root | grep -q "PROD.*'${VERSION3}'" || die "Did not find ${VERSION3} from version.root provenance" $? | ||
|
||
cmsRun ${SCRAM_TEST_PATH}/test_merge_two_files.py version1.root version3.root --output merged_files3.root --bypassVersionCheck|| die "Merge version1.root version3.root failed" $? | ||
|
||
cmsRun ${SCRAM_TEST_PATH}/testReducedProcessHistory_cfg.py --input merged_files3.root --bypassVersionCheck && die "testReducedProcessHistory_cfg.py merged_files3.root did not fail" 1 | ||
|
||
cmsRun ${SCRAM_TEST_PATH}/testReducedProcessHistory_cfg.py --input merged_files3.root --bypassVersionCheck --expectNewRun || die "testReducedProcessHistory_cfg.py merged_files3.root --expectNewRun failed" $? | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description='Create files for reduced ProcessHistory test') | ||
parser.add_argument("--version", type=str, help="CMSSW version to be used in the ProcessHistory") | ||
parser.add_argument("--lumi", type=int, help="LuminosityBlock number") | ||
parser.add_argument("--output", type=str, help="Output file name") | ||
|
||
args = parser.parse_args() | ||
|
||
process = cms.Process("PROD") | ||
process._specialOverrideReleaseVersionOnlyForTesting(args.version) | ||
|
||
process.maxEvents.input = 10 | ||
|
||
from FWCore.Modules.modules import EmptySource | ||
process.source = EmptySource( | ||
firstLuminosityBlock = args.lumi | ||
) | ||
|
||
from IOPool.Output.modules import PoolOutputModule | ||
process.out = PoolOutputModule( | ||
fileName = args.output | ||
) | ||
|
||
from FWCore.Framework.modules import IntProducer | ||
process.intProducer = IntProducer(ivalue = 42) | ||
|
||
from FWCore.Integration.modules import ThingWithMergeProducer | ||
process.thingWithMergeProducer = ThingWithMergeProducer() | ||
|
||
process.t = cms.Task( | ||
process.intProducer, | ||
process.thingWithMergeProducer, | ||
) | ||
process.p = cms.Path(process.t) | ||
process.ep = cms.EndPath(process.out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description='Test reduced ProcessHistory') | ||
parser.add_argument("--input", type=str, help="Input file") | ||
parser.add_argument("--bypassVersionCheck", action="store_true", help="Bypass version check") | ||
parser.add_argument("--expectNewRun", action="store_true", help="Set this if a new run is expected between the original files") | ||
|
||
args = parser.parse_args() | ||
|
||
process = cms.Process("READ") | ||
|
||
from IOPool.Input.modules import PoolSource | ||
process.source = PoolSource( | ||
fileNames = [f"file:{args.input}"], | ||
bypassVersionCheck = args.bypassVersionCheck, | ||
) | ||
|
||
from FWCore.Framework.modules import TestMergeResults, RunLumiEventAnalyzer | ||
process.testmerge = TestMergeResults( | ||
expectedBeginRunProd = [10001, 20004, 10003], # should be only one run | ||
expectedEndRunProd = [100001, 200004, 100003], | ||
expectedBeginLumiProd = [101, 102, 103, | ||
101, 102, 103], | ||
expectedEndLumiProd = [1001, 1002, 1003, | ||
1001, 1002, 1003], | ||
|
||
expectedBeginRunNew = [10001, 10002, 10003], # should be only one run | ||
expectedEndRunNew = [100001, 100002, 100003], | ||
expectedBeginLumiNew = [101, 102, 103, | ||
101, 102, 103], | ||
expectedEndLumiNew = [1001, 1002, 1003, | ||
1001, 1002, 1003], | ||
expectedProcessHistoryInRuns = [ | ||
'PROD', | ||
'MERGETWOFILES', | ||
'READ' | ||
] | ||
) | ||
if args.expectNewRun: | ||
process.testmerge.expectedBeginRunProd[1] = 10002 | ||
process.testmerge.expectedEndRunProd[1] = 100002 | ||
|
||
process.test = RunLumiEventAnalyzer( | ||
expectedRunLumiEvents = [ | ||
1, 0, 0, # beginRun | ||
1, 1, 0, # beginLumi | ||
1, 1, 1, | ||
1, 1, 2, | ||
1, 1, 3, | ||
1, 1, 4, | ||
1, 1, 5, | ||
1, 1, 6, | ||
1, 1, 7, | ||
1, 1, 8, | ||
1, 1, 9, | ||
1, 1, 10, | ||
1, 1, 0, # endLumi | ||
1, 2, 0, # beginLumi | ||
1, 2, 1, | ||
1, 2, 2, | ||
1, 2, 3, | ||
1, 2, 4, | ||
1, 2, 5, | ||
1, 2, 6, | ||
1, 2, 7, | ||
1, 2, 8, | ||
1, 2, 9, | ||
1, 2, 10, | ||
1, 2, 0, # endLumi | ||
1, 0, 0, # endRun | ||
] | ||
) | ||
if args.expectNewRun: | ||
# Insert endRun+beginRun to the expected transition sequence | ||
endLumiIndex = 3*(10+3) | ||
process.test.expectedRunLumiEvents = process.test.expectedRunLumiEvents[:endLumiIndex] + [ | ||
1, 0, 0, # endRun | ||
1, 0, 0, # beginRun | ||
1, 3, 0, # beginLumi | ||
1, 3, 1, | ||
1, 3, 2, | ||
1, 3, 3, | ||
1, 3, 4, | ||
1, 3, 5, | ||
1, 3, 6, | ||
1, 3, 7, | ||
1, 3, 8, | ||
1, 3, 9, | ||
1, 3, 10, | ||
1, 3, 0, # endLumi | ||
1, 0, 0, # endRun | ||
] | ||
|
||
process.p = cms.Path( | ||
process.testmerge + | ||
process.test | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters