From 35d8da5c62c2ce6b02c9d2c66e3381318b0006da Mon Sep 17 00:00:00 2001
From: giordano <domenico.giordano@cern.ch>
Date: Thu, 19 Sep 2019 17:50:59 +0200
Subject: [PATCH] adapt to new json structure

---
 lhcb/gen-sim/lhcb-gen-sim/parseResults.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lhcb/gen-sim/lhcb-gen-sim/parseResults.sh b/lhcb/gen-sim/lhcb-gen-sim/parseResults.sh
index b1033c88..12f328b4 100644
--- a/lhcb/gen-sim/lhcb-gen-sim/parseResults.sh
+++ b/lhcb/gen-sim/lhcb-gen-sim/parseResults.sh
@@ -26,8 +26,9 @@ function parseResults(){
   local resJSON=`grep "EVENT LOOP" proc_*/out_*.log  | \
                    awk -F"|" 'BEGIN{amin=1000000;amax=0;count=0;}  \
                               { val=1000.*$5/$6; a[count]=val; count+=1; sum+=val; if(amax<val) amax=val; if(amin>val) amin=val} \
-                             END{n = asort(a); if (n % 2) {   median=a[(n + 1) / 2]; } else {median=(a[(n / 2)] + a[(n / 2) + 1])/ 2.0;}; printf "{\"score\": %.4f, \"avg\": %.4f, \"median\": %.4f, \"min\": %.4f, \"max\": %.4f}", sum, sum/count, median, amin, amax
-}' || (echo "\"[ERROR] Something went wrong in parsing the Event Throughput score\""; exit 1)`
+                             END{n = asort(a); if (n % 2) {   median=a[(n + 1) / 2]; } else {median=(a[(n / 2)] + a[(n / 2) + 1])/ 2.0;}; 
+printf "\"wl-scores\": {\"sim\": %.4f} , \"wl-stats\": {\"score\": %.4f, \"avg\": %.4f, \"median\": %.4f, \"min\": %.4f, \"max\": %.4f}", sum, sum, sum/count, median, amin, amax
+}' || (echo "\"wl-scores\":{}"; exit 1)`
   shstatus=$?
   [ "$shstatus" != "0" ] && s_msg="ERROR in bash parsing"
   echo $resJSON
@@ -40,14 +41,14 @@ function parseResults(){
   local app="\"UNKNOWN\""
   if [ -f $BMKDIR/version.json ]; then app=$(cat $BMKDIR/version.json); fi
   local OUTPUT=${APP}_summary_old.json
-  echo -e "{\"copies\":$NCOPIES , \"threads_per_copy\":1 , \"events_per_thread\" : $NEVENTS_THREAD , \"throughput_score\": $resJSON , \"log\": \"${s_msg}\", \"app\":${app} }" > $OUTPUT
+  echo -e "{\"copies\":$NCOPIES , \"threads_per_copy\":1 , \"events_per_thread\" : $NEVENTS_THREAD , $resJSON , \"log\": \"${s_msg}\", \"app\":${app} }" > $OUTPUT
   cat $OUTPUT
   #-----------------------
   # Parse results (python)
   #-----------------------
   echo -e "\n[parseResults] python parser starting using $(python3 -V &> /dev/stdout)"
   local resJSON2 # declare 'local' separately to avoid masking $? (https://stackoverflow.com/a/4421282)
-  resJSON2=$(PYTHONPATH=${parseResultsDir} python3 -c "from parseResults import *; parseBmkDir('.')") # same directory as parseResults.sh
+  resJSON2=$(PYTHONPATH=${parseResultsDir} python -c "from parseResults import *; parseBmkDir('.')") # same directory as parseResults.sh
   pystatus=$?
   [ "$pystatus" != "0" ] && s_msg="ERROR in python parsing"
   echo $resJSON2
-- 
GitLab