failure_report: add parallel execution

This commit is contained in:
Arne Morten Kvarving committed 2025-12-09 10:04:19 +01:00
1 parent c53088794a
commit 38e23b82bd
2 files changed
+14 -8

No files matched your search

+6 -4
View File
@@ -6,6 +6,7 @@ OPM_TESTS_ROOT=$1
BUILD_DIR=$2
RESULT_DIR=$3
SOURCE_DIR=`dirname "$0"`
JOBS=${BUILDTHREADS:-16}
FAILED_TESTS=`cat $BUILD_DIR/Testing/Temporary/LastTestsFailed*.log`
@@ -13,6 +14,7 @@ mkdir -p $BUILD_DIR/failure_report
cd $BUILD_DIR/failure_report
rm -f *
JOBLIST=""
for failed_test in $FAILED_TESTS
do
if grep -q -E "compareECLFiles" <<< $failed_test
@@ -23,8 +25,7 @@ do
dir_name=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="DIRNAME" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
file_name=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="FILENAME" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
test_name=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="TESTNAME" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
echo "Processing ${test_name}"
$SOURCE_DIR/plot_well_comparison.py -r $OPM_TESTS_ROOT/$dir_name/opm-simulation-reference/$binary/$file_name -s $RESULT_DIR/tests/results/$binary+$test_name/$file_name -c $test_name -o plot
JOBLIST+="-r $OPM_TESTS_ROOT/$dir_name/opm-simulation-reference/$binary/$file_name -s $RESULT_DIR/tests/results/$binary+$test_name/$file_name -c $test_name -o plot\\n"
elif grep -q -E "compareSeparateECLFiles" <<< $failed_test
then
failed_test=`echo $failed_test | sed -e 's/.*://g' -e 's/\+/./g'`
@@ -34,11 +35,12 @@ do
file_name1=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="FILENAME1" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
file_name2=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="FILENAME2" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
test_name=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="TESTNAME" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
echo "Processing ${test_name}"
$SOURCE_DIR/plot_well_comparison.py -r $RESULT_DIR/tests/results/$binary+$test_name/$file_name1 -s $RESULT_DIR/tests/results/$binary+$test_name/$file_name2 -c $test_name -o plot -t "$file_name1" -u "$file_name2"
JOBLIST+="-r $RESULT_DIR/tests/results/$binary+$test_name/$file_name1 -s $RESULT_DIR/tests/results/$binary+$test_name/$file_name2 -c $test_name -o plot -t $file_name1 -u $file_name2\\n"
fi
done
echo -e $JOBLIST | xargs -L1 -P${JOBS} $SOURCE_DIR/plot_well_comparison.py
if test -n "$FAILED_TESTS"
then
$SOURCE_DIR/plot_well_comparison.py -o rename
+8 -4
View File
@@ -5,6 +5,7 @@
import argparse
from datetime import datetime, timedelta
from filelock import FileLock
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
from matplotlib.backends.backend_pdf import PdfPages
@@ -84,16 +85,18 @@ def run_analysis(ref_file_name, sys_file_name, test_name, ref_name, sim_name):
p.close()
if os.path.exists('max_devs.pkl'):
with open('max_devs.pkl', 'rb') as f:
max_deviations = pickle.load(f)
with FileLock('max_devs.lck'):
with open('max_devs.pkl', 'rb') as f:
max_deviations = pickle.load(f)
else:
max_deviations = {}
max_dev = max(deviation, key = lambda x: deviation[x])
max_deviations[test_name] = deviation[max_dev]
with open('max_devs.pkl', 'wb') as f:
pickle.dump(max_deviations, f)
with FileLock('max_devs.lck'):
with open('max_devs.pkl', 'wb') as f:
pickle.dump(max_deviations, f)
# Rename files to rank them according to maximum deviations
def reorder_files():
@@ -117,6 +120,7 @@ parser.add_argument('-o', choices=['plot', 'rename'], help='Operation to do', re
args = parser.parse_args()
if args.operation == 'plot':
print(f"Processing {args.test_name}")
run_analysis(args.ref_file, args.sim_file, args.test_name, args.ref_name, args.sim_name)
else:
reorder_files()