forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-pr-comparisons
executable file
·260 lines (179 loc) · 9.85 KB
/
run-pr-comparisons
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#!/bin/sh -ex
BASE_URL=$ARTIFACTS_MACHINE:/data/sdt/SDT/jenkins-artifacts/ib-baseline-tests/$RELEASE_FORMAT/$ARCHITECTURE/$REAL_ARCH/matrix-results/
PULL_REQUEST_BASE_URL=$ARTIFACTS_MACHINE:/data/sdt/SDT/jenkins-artifacts/pull-request-integration/PR-$PULL_REQUEST_NUMBER/$PULL_REQUEST_JOB_ID/runTheMatrix-results/
WFS_WITH_ERRORS=''
MAPPING_FILE=wf_mapping.txt
rsync $BASE_URL$MAPPING_FILE $WORKSPACE
ERRORS_FILE=wf_errors.txt
rsync $BASE_URL$ERRORS_FILE $WORKSPACE
# This file is generated by this script
DAS_NON_CONSISTENT_WFS_FILE=wf_non_consistent_das.txt
for wf in ${WORKFLOWS_LIST//,/ }
do
WF_PATH=`grep -F $wf $WORKSPACE/$MAPPING_FILE`
if [ "X$WF_PATH" = X ]; then
ERR_DETAILS=`grep $wf $WORKSPACE/$ERRORS_FILE`
WFS_WITH_ERRORS=$ERR_DETAILS,$WFS_WITH_ERRORS
else
echo "Going to compare: $wf"
echo $WF_PATH
echo ""
WORKFLOWS_TO_COMPARE=$WORKFLOWS_TO_COMPARE,$WF_PATH
fi
done
#remove first ,
WORKFLOWS_TO_COMPARE=`echo $WORKFLOWS_TO_COMPARE | sed 's/^.//'`
DETAILS_FILE=$WORKSPACE/'comparisonDetails.txt'
echo 'BASE_IB;'$RELEASE_FORMAT >> $DETAILS_FILE
echo 'PR_NUMBER;'$PULL_REQUEST_NUMBER >> $DETAILS_FILE
echo 'ADDITIONAL_PRS;'$ADDITIONAL_PULL_REQUESTS >> $DETAILS_FILE
echo 'ARCHITECTURE;'$ARCHITECTURE >> $DETAILS_FILE
echo 'REAL_ARCH;'$REAL_ARCH >> $DETAILS_FILE
echo 'MACHINE ARCHITECTURE:' >> $DETAILS_FILE
cat /proc/cpuinfo | grep "model name" >> $DETAILS_FILE
export SCRAM_ARCH=$ARCHITECTURE
scram project $RELEASE_FORMAT
cd $RELEASE_FORMAT
eval `scram run -sh`
git cms-addpkg Utilities/RelMon
cd ..
mkdir $WORKSPACE/results
cd $WORKSPACE/results
# --------------------------------------------------------------------------
# Download the Files
# --------------------------------------------------------------------------
mkdir $WORKSPACE/results/files
cd $WORKSPACE/results/files
for WF in ${WORKFLOWS_TO_COMPARE//,/ }; do
WF_DIR=`echo $WF | cut -d "/" -f1`
echo '#######################################'
echo 'downloading:'
echo $WF
WF_NUMBER=`echo $WF | cut -d'_' -f1`
WF_BASE_URL=$BASE_URL$WF
DAS_QUERY_LOG_BASE_URL=$BASE_URL$WF_DIR'/step1_dasquery.log'
WF_PR_URL=$PULL_REQUEST_BASE_URL$WF
DAS_QUERY_LOG_PR_URL=$PULL_REQUEST_BASE_URL$WF_DIR'/step1_dasquery.log'
WF_FILE=$(basename $WF)
mkdir $WORKSPACE/results/files/$WF_DIR
cd $WORKSPACE/results/files/$WF_DIR
rsync $WF_BASE_URL $WORKSPACE/results/files/$WF_DIR/$RELEASE_FORMAT-$WF_FILE
#The file step1_dasquery.log could not exist for the current workflow, this is normal
rsync $DAS_QUERY_LOG_BASE_URL $WORKSPACE/results/files/$WF_DIR/$RELEASE_FORMAT-'step1_dasquery.log' || true
rsync $WF_PR_URL $WORKSPACE/results/files/$WF_DIR/$PULL_REQUEST_NUMBER-$WF_FILE
rsync $DAS_QUERY_LOG_PR_URL $WORKSPACE/results/files/$WF_DIR/$PULL_REQUEST_NUMBER-'step1_dasquery.log' || true
# check that the step1_dasquery.log files are correct.
NUM_FILES=$(( `ls $WORKSPACE/results/files/$WF_DIR/*-step1_dasquery.log | wc -l` ))
# if there is only one of them something is wrong, but if there is none is ok
if [ "$NUM_FILES" -eq "1" ]; then
WFS_WITH_DAS_INCONSISTENCY=$WF_NUMBER,$WFS_WITH_DAS_INCONSISTENCY
elif [ "$NUM_FILES" -eq "2" ]; then
PR_DAS_QUERY_LOG=$WORKSPACE/results/files/$WF_DIR/$PULL_REQUEST_NUMBER-'step1_dasquery.log'
BASELINE_DAS_QUERY_LOG=$WORKSPACE/results/files/$WF_DIR/$RELEASE_FORMAT-'step1_dasquery.log'
for PR_ROOT_FILE in `grep '.root' $PR_DAS_QUERY_LOG`; do
if ! grep $PR_ROOT_FILE $BASELINE_DAS_QUERY_LOG; then
WFS_WITH_DAS_INCONSISTENCY=$WF_NUMBER,$WFS_WITH_DAS_INCONSISTENCY
break
fi
done
fi
cd ..
done
echo $WFS_WITH_DAS_INCONSISTENCY >> $WORKSPACE/$DAS_NON_CONSISTENT_WFS_FILE
cd ..
echo 'Finished downloading files:'
rsync $ARTIFACTS_MACHINE:/data/sdt/SDT/jenkins-artifacts/pull-request-integration/PR-$PULL_REQUEST_NUMBER/$PULL_REQUEST_JOB_ID/testsResults.txt $WORKSPACE/results/testsResults.txt
sed -i "s/COMPARISON;QUEUED/COMPARISON;RUNNING/g" $WORKSPACE/results/testsResults.txt
rsync $WORKSPACE/results/testsResults.txt $ARTIFACTS_MACHINE:/data/sdt/SDT/jenkins-artifacts/pull-request-integration/PR-$PULL_REQUEST_NUMBER/$PULL_REQUEST_JOB_ID/testsResults.txt
pwd
ls -R
# --------------------------------------------------------------------------
# Default Comparison
# --------------------------------------------------------------------------
if [ "X$RUN_DEFAULT_COMP" = Xtrue ]; then
mkdir $WORKSPACE/results/default-comparison
for WF in ${WORKFLOWS_TO_COMPARE//,/ }; do
WF_BASE_URL=$BASE_URL$WF
WF_PR_URL=$PULL_REQUEST_BASE_URL$WF
WF_FILE=$(basename $WF)
WF_DIR=`echo $WF | cut -d "/" -f1`
WF_NUMBER=`echo $WF | cut -d'_' -f1`
#create the output dir
OUTPUT_DIR=$WORKSPACE/results/default-comparison/$WF_DIR
mkdir -p $OUTPUT_DIR
#requires checking out Utilities/RelMon from the release.
# create a mini script for running this comparisons in parallel
echo '#!/bin/sh -ex' >> $WORKSPACE/results/default-comparison/command-$WF_NUMBER
echo 'compare_using_files.py '$WORKSPACE'/results/files/'$WF_DIR'/'$RELEASE_FORMAT'-'$WF_FILE' '$WORKSPACE'/results/files/'$WF_DIR'/'$PULL_REQUEST_NUMBER'-'$WF_FILE' -o '$OUTPUT_DIR' --metas " '$RELEASE_FORMAT' @@@ '$RELEASE_FORMAT' + '$PULL_REQUEST_NUMBER' " --use_black_file -C -R -p --no_successes -s b2b --standalone 2>&1 | tee -a '$OUTPUT_DIR'RelMonComp-'$WF_NUMBER'.log' >> $WORKSPACE/results/default-comparison/command-$WF_NUMBER
echo "pushd $OUTPUT_DIR" >> $WORKSPACE/results/default-comparison/command-$WF_NUMBER
echo "cp RelMonSummary.html index.html" >> $WORKSPACE/results/default-comparison/command-$WF_NUMBER
echo 'find . -name "*" | xargs sh -c "sed -i -s 's/..\/RelMonSummary.html/RelMonSummary.html/g' || true"' >> $WORKSPACE/results/default-comparison/command-$WF_NUMBER
echo "popd" >> $WORKSPACE/results/default-comparison/command-$WF_NUMBER
chmod 755 $WORKSPACE/results/default-comparison/command-$WF_NUMBER
# execute the script
$WORKSPACE/results/default-comparison/command-$WF_NUMBER &
done
jobs
wait
echo 'Finished with default comparison'
fi
# --------------------------------------------------------------------------
# JR-Comparison
# --------------------------------------------------------------------------
if [ "X$RUN_JR_COMP" = Xtrue ]; then
JR_COMP_DIR=$WORKSPACE/results/JR-comparison
mkdir -p $JR_COMP_DIR
cp $WORKSPACE/cms-bot/comparisons/validateJR.sh $JR_COMP_DIR
cp $WORKSPACE/cms-bot/comparisons/validate.C $JR_COMP_DIR
cp $WORKSPACE/cms-bot/comparisons/matrix_70X.txt $JR_COMP_DIR
mkdir -p $HOME/tools
cp $WORKSPACE/cms-bot/comparisons/validate.C $HOME/tools
#Download the baseline files
rsync -r $ARTIFACTS_MACHINE:/data/sdt/SDT/jenkins-artifacts/ib-baseline-tests/$RELEASE_FORMAT/$ARCHITECTURE/$REAL_ARCH/matrix-results/ $JR_COMP_DIR/$RELEASE_FORMAT
#Download the files for the pr
rsync -r $ARTIFACTS_MACHINE:/data/sdt/SDT/jenkins-artifacts/pull-request-integration/PR-$PULL_REQUEST_NUMBER/$PULL_REQUEST_JOB_ID/runTheMatrix-results/ $JR_COMP_DIR/PR-$PULL_REQUEST_NUMBER
cd $JR_COMP_DIR
source $JR_COMP_DIR/validateJR.sh $JR_COMP_DIR/PR-$PULL_REQUEST_NUMBER $JR_COMP_DIR/$RELEASE_FORMAT OldVSNew matrix_70X.txt 2>&1 | tee -a $JR_COMP_DIR/validateJR.log
cd ..
echo 'source '$JR_COMP_DIR'/validateJR.sh '$JR_COMP_DIR'/PR-'$PULL_REQUEST_NUMBER' '$JR_COMP_DIR'/'$RELEASE_FORMAT' OldVSNew matrix_70X.txt 2>&1 | tee -a '$JR_COMP_DIR'/validateJR.log' > $JR_COMP_DIR/command
echo 'Finished with JR comparison:'
fi
# ----------------------------------------------------------------------------
# Alternative Comparison
# ----------------------------------------------------------------------------
if [ "X$RUN_ALT_COMP" = Xtrue ]; then
ALT_COMP_DIR=$WORKSPACE/results/alternative-comparison
mkdir -p $ALT_COMP_DIR
DQM_COMP_PARAMS_FILE=$ALT_COMP_DIR/comparisonParams.txt
$WORKSPACE/cms-bot/comparisons/analyzeFWComparison.py $JR_COMP_DIR $DQM_COMP_PARAMS_FILE 2>&1 | tee -a $ALT_COMP_DIR/assignedParameters.log
for WF in ${WORKFLOWS_TO_COMPARE//,/ }; do
WF_BASE_URL=$BASE_URL$WF
WF_PR_URL=$PULL_REQUEST_BASE_URL$WF
WF_FILE=$(basename $WF)
WF_DIR=`echo $WF | cut -d "/" -f1`
WF_NUMBER=`echo $WF | cut -d'_' -f1`
BASE_FILE=$WORKSPACE/results/files/$WF_DIR/$RELEASE_FORMAT-$WF_FILE
COMP_FILE=$WORKSPACE/results/files/$WF_DIR/$PULL_REQUEST_NUMBER-$WF_FILE
mkdir -p $ALT_COMP_DIR/$WF_NUMBER
cp $WORKSPACE/cms-bot/comparisons/compareValHists.C $ALT_COMP_DIR/$WF_NUMBER
cp $WORKSPACE/cms-bot/comparisons/makeDiff.sh $ALT_COMP_DIR/$WF_NUMBER
eval $( cat $DQM_COMP_PARAMS_FILE | grep "FOR_WF=$WF_NUMBER;" )
echo $MOD
# create a mini script for running this comparisons in parallel
echo '#!/bin/sh -ex' >> $ALT_COMP_DIR/command-$WF_NUMBER
echo "pushd $ALT_COMP_DIR/$WF_NUMBER" >> $ALT_COMP_DIR/command-$WF_NUMBER
echo "source $ALT_COMP_DIR/$WF_NUMBER/makeDiff.sh $BASE_FILE $COMP_FILE $WF_NUMBER-result.ps 0 $MOD 2>&1 | tee -a $ALT_COMP_DIR/runDQMComp-$WF_NUMBER.log" >> $ALT_COMP_DIR/command-$WF_NUMBER
echo "mv diff.ps $ALT_COMP_DIR/$WF_NUMBER-result.ps || true" >> $ALT_COMP_DIR/command-$WF_NUMBER
echo "mv diff.pdf $ALT_COMP_DIR/$WF_NUMBER-result.pdf || true" >> $ALT_COMP_DIR/command-$WF_NUMBER
echo "gzip -f $ALT_COMP_DIR/$WF_NUMBER-result.ps || true" >> $ALT_COMP_DIR/command-$WF_NUMBER
echo "gzip -f $ALT_COMP_DIR/$WF_NUMBER-result.pdf || true" >> $ALT_COMP_DIR/command-$WF_NUMBER
echo "popd" >> $ALT_COMP_DIR/command-$WF_NUMBER
chmod 755 $ALT_COMP_DIR/command-$WF_NUMBER
$ALT_COMP_DIR/command-$WF_NUMBER &
done
jobs
wait
echo 'Finished with alternative comparison:'
fi
sed -i "s/COMPARISON;RUNNING/COMPARISON;$BUILD_NUMBER/g" $WORKSPACE/results/testsResults.txt
rsync $WORKSPACE/results/testsResults.txt $ARTIFACTS_MACHINE:/data/sdt/SDT/jenkins-artifacts/pull-request-integration/PR-$PULL_REQUEST_NUMBER/$PULL_REQUEST_JOB_ID/testsResults.txt