Skip to content
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

Alignment/MillePedeAlignmentAlgorithm/test_CreateFileLists: give a better error message in case of failure #38271

Merged
merged 1 commit into from Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion Alignment/CommonAlignment/scripts/tkal_create_file_lists.py
Expand Up @@ -916,6 +916,7 @@ def das_client(query, check_key = None):
"""

error = True
das_data = {'status': 'error'}
for i in range(5): # maximum of 5 tries
try:
das_data = cmssw_das_client.get_data(query, limit = 0)
Expand All @@ -924,6 +925,7 @@ def das_client(query, check_key = None):
continue
except ValueError as e:
if str(e) == "No JSON object could be decoded":
das_data['reason'] = str(e)
continue

if das_data["status"] == "ok":
Expand All @@ -945,7 +947,7 @@ def das_client(query, check_key = None):
if das_data["status"] == "error":
print_msg("DAS query '{}' failed 5 times. "
"The last time for the the following reason:".format(query))
print(das_data["reason"])
print(das_data.get("reason", "ERROR:UNKNOWN"))
sys.exit(1)
return das_data["data"]

Expand Down
2 changes: 1 addition & 1 deletion Alignment/MillePedeAlignmentAlgorithm/test/BuildFile.xml
Expand Up @@ -9,7 +9,7 @@
</library>
<test name="test_PrepareInputDb" command="mps_prepare_input_db.py -g auto:run2_data -r 1 -o ${LOCALTOP}/tmp/test_input.db"/>
<test name="test_MpsWorkFlow" command="test_mps-workflow.sh"/>
<test name="test_CreateFileLists" command="mps_create_file_lists.py --test-mode --force -i /OVERRIDDEN/IN/TESTMODE -o ${LOCALTOP}/tmp/mps_create_file_lists -n 200000 --iov 42 --iov 174"/>
<test name="test_CreateFileLists" command="tkal_create_file_lists.py --test-mode --force -i /OVERRIDDEN/IN/TESTMODE -o ${LOCALTOP}/tmp/mps_create_file_lists -n 200000 --iov 42 --iov 174"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we move this unit tests to Alignment/CommonAlignment as tkal_create_file_lists.py exists in that package. Any change in this script will then allow its automatic testing

<test name="test-pede" command="pede -t">
<use name="millepede"/>
<flags USE_UNITTEST_DIR="1"/>
Expand Down