-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error code returned by cmsRun on a FallbackFileOpenError #42249
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 10 additions & 0 deletions
10
IOPool/Input/test/sitelocalconfig/noFallbackFile/local/storage.json
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,10 @@ | ||
[ | ||
{ "site": "DUMMY", | ||
"volume": "DummyVolume", | ||
"protocols": [ | ||
{ "protocol": "protocolThatDoesNotExist", | ||
"prefix": "abc" | ||
} | ||
] | ||
} | ||
] |
7 changes: 7 additions & 0 deletions
7
IOPool/Input/test/sitelocalconfig/noFallbackFile/site-local-config.xml
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,7 @@ | ||
<site-local-config> | ||
<site name="DUMMY"> | ||
<data-access> | ||
<catalog volume="DummyVolume" protocol="protocolThatDoesNotExist"/> | ||
</data-access> | ||
</site> | ||
</site-local-config> |
18 changes: 18 additions & 0 deletions
18
IOPool/Input/test/sitelocalconfig/useFallbackFile/local/storage.json
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,18 @@ | ||
[ | ||
{ "site": "DUMMY", | ||
"volume": "DummyVolume1", | ||
"protocols": [ | ||
{ "protocol": "protocolThatDoesNotExist1", | ||
"prefix": "abc" | ||
} | ||
] | ||
}, | ||
{ "site": "DUMMY", | ||
"volume": "DummyVolume2", | ||
"protocols": [ | ||
{ "protocol": "protocolThatDoesNotExist2", | ||
"prefix": "abc" | ||
} | ||
] | ||
} | ||
] |
8 changes: 8 additions & 0 deletions
8
IOPool/Input/test/sitelocalconfig/useFallbackFile/site-local-config.xml
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,8 @@ | ||
<site-local-config> | ||
<site name="DUMMY"> | ||
<data-access> | ||
<catalog volume="DummyVolume1" protocol="protocolThatDoesNotExist1"/> | ||
<catalog volume="DummyVolume2" protocol="protocolThatDoesNotExist2"/> | ||
</data-access> | ||
</site> | ||
</site-local-config> |
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,34 @@ | ||
#!/bin/bash | ||
|
||
# Pass in name and status | ||
function die { echo $1: status $2 ; exit $2; } | ||
|
||
mkdir -p SITECONF | ||
mkdir -p SITECONF/local | ||
mkdir -p SITECONF/local/JobConfig | ||
|
||
export SITECONFIG_PATH=${PWD}/SITECONF/local | ||
LOCAL_TEST_DIR=${SCRAM_TEST_PATH} | ||
|
||
cp ${LOCAL_TEST_DIR}/sitelocalconfig/noFallbackFile/site-local-config.xml ${SITECONFIG_PATH}/JobConfig/ | ||
cp ${LOCAL_TEST_DIR}/sitelocalconfig/noFallbackFile/local/storage.json ${SITECONFIG_PATH}/ | ||
F1=${LOCAL_TEST_DIR}/test_fileOpenErrorExitCode_cfg.py | ||
cmsRun -j NoFallbackFile_jobreport.xml $F1 -- --input FileThatDoesNotExist.root && die "$F1 should have failed but didn't, exit code was 0" 1 | ||
|
||
CMSRUN_EXIT_CODE=$(edmFjrDump --exitCode NoFallbackFile_jobreport.xml) | ||
echo "Exit code after first run of test_fileOpenErrorExitCode_cfg.py is ${CMSRUN_EXIT_CODE}" | ||
if [ "x${CMSRUN_EXIT_CODE}" != "x8020" ]; then | ||
echo "Unexpected cmsRun exit code after FileOpenError, exit code from jobReport ${CMSRUN_EXIT_CODE} which is different from the expected 8020" | ||
exit 1 | ||
fi | ||
|
||
cp ${LOCAL_TEST_DIR}/sitelocalconfig/useFallbackFile/site-local-config.xml ${SITECONFIG_PATH}/JobConfig/ | ||
cp ${LOCAL_TEST_DIR}/sitelocalconfig/useFallbackFile/local/storage.json ${SITECONFIG_PATH}/ | ||
cmsRun -j UseFallbackFile_jobreport.xml $F1 -- --input FileThatDoesNotExist.root && die "$F1 should have failed after file fallback but didn\'t, exit code was 0" 1 | ||
|
||
CMSRUN_EXIT_CODE=$(edmFjrDump --exitCode UseFallbackFile_jobreport.xml) | ||
echo "Exit code after second run of test_fileOpenErrorExitCode_cfg.py is ${CMSRUN_EXIT_CODE}" | ||
if [ "x${CMSRUN_EXIT_CODE}" != "x8028" ]; then | ||
echo "Unexpected cmsRun exit code after FallbackFileOpenError, exit code from jobReport ${CMSRUN_EXIT_CODE} which is different from the expected 8028" | ||
exit 1 | ||
fi |
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,17 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
import argparse | ||
import sys | ||
|
||
parser = argparse.ArgumentParser(prog=sys.argv[0], description="Test FileOpenErrorExitCode") | ||
parser.add_argument("--input", type=str, default=[], nargs="*", help="Optional list of input files") | ||
|
||
argv = sys.argv[:] | ||
if '--' in argv: | ||
argv.remove("--") | ||
args, unknown = parser.parse_known_args(argv) | ||
|
||
process = cms.Process("TEST") | ||
|
||
process.source = cms.Source("PoolSource", | ||
fileNames = cms.untracked.vstring("/store/"+x for x in args.input) | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stlammel are you OK with how this is handling a mis-configured storage.json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, if you get here it seg faults. The change is that this throws an informative exception instead of allowing the seg fault to occur. The seg fault is fatal, which is why I made the exception fatal. A couple alternatives I can imagine.
We could remove this error handling change from this PR and handle it in a separate PR.
Even if we approve this PR as is, we can modify this error handling again later in a separate PR.
The exception could be non-fatal and just result in a logWarning and skip like other exceptions in the FileLocator constructor. InputFileCatalog currently catches exceptions and swallows them after a logWarning, although if all FileLocator constructors fail it will throw a different exception anyway.
I am open to any other very simple suggestion here. If we want something more complex or we need time for discussion and consideration, then we should break it out into a separate PR and separate it from this bug fix. I only included it here because I thought it was such a small issue that it didn't deserve a separate PR.