From 1b3ebe5a693d6f04f1db703d1cedb9db33b325ce Mon Sep 17 00:00:00 2001
From: giordano <domenico.giordano@cern.ch>
Date: Thu, 19 Sep 2019 22:14:22 +0200
Subject: [PATCH] applying new json schema

---
 .../jobs/bad_1/alice-gen-sim_summary.json             |  2 +-
 .../jobs/good_1/alice-gen-sim_summary.json            |  2 +-
 alice/gen-sim/alice-gen-sim/parseResults.sh           | 11 ++++++-----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/alice/gen-sim/alice-gen-sim/jobs/bad_1/alice-gen-sim_summary.json b/alice/gen-sim/alice-gen-sim/jobs/bad_1/alice-gen-sim_summary.json
index 1e66c884..5979de68 100644
--- a/alice/gen-sim/alice-gen-sim/jobs/bad_1/alice-gen-sim_summary.json
+++ b/alice/gen-sim/alice-gen-sim/jobs/bad_1/alice-gen-sim_summary.json
@@ -1 +1 @@
-{"copies":2 , "threads_per_copy":1 , "events_per_thread" : 1 , "CPU_score": "" , "log": "[ERROR] There is at least one job not finished properly", "app": {"version":"v0.15","description":"ALICE pp GEN-SIM","cvmfs_checksum":"9986a9a83745b416a510788e1f35d807","bmkdata_checksum":"b94489e16c0a77f2a0a9aaf333260a96","bmk_checksum":"6c5c2fd1379388c9b1cbd3888e5ecbd3"} }
+{"copies":2 , "threads_per_copy":1 , "events_per_thread" : 1 , "wl-scores":{} , "log": "[ERROR] There is at least one job not finished properly", "app": {"version":"v0.15","description":"ALICE pp GEN-SIM","cvmfs_checksum":"9986a9a83745b416a510788e1f35d807","bmkdata_checksum":"b94489e16c0a77f2a0a9aaf333260a96","bmk_checksum":"6c5c2fd1379388c9b1cbd3888e5ecbd3"} }
diff --git a/alice/gen-sim/alice-gen-sim/jobs/good_1/alice-gen-sim_summary.json b/alice/gen-sim/alice-gen-sim/jobs/good_1/alice-gen-sim_summary.json
index 59d971fc..2fe43f2c 100644
--- a/alice/gen-sim/alice-gen-sim/jobs/good_1/alice-gen-sim_summary.json
+++ b/alice/gen-sim/alice-gen-sim/jobs/good_1/alice-gen-sim_summary.json
@@ -1 +1 @@
-{"copies":4 , "threads_per_copy":1 , "events_per_thread" : 1 , "CPU_score": {"score": 0.0606, "avg": 0.0152, "median": 0.0152, "min": 0.0152, "max": 0.0152} , "log": "ok", "app": {"version":"v0.15","description":"ALICE pp GEN-SIM","cvmfs_checksum":"9986a9a83745b416a510788e1f35d807","bmkdata_checksum":"b94489e16c0a77f2a0a9aaf333260a96","bmk_checksum":"6c5c2fd1379388c9b1cbd3888e5ecbd3"} }
+{"copies":4 , "threads_per_copy":1 , "events_per_thread" : 1 , "wl-scores": {"gen-sim": 0.0606} , "wl-stats": {"score": 0.0606, "avg": 0.0152, "median": 0.0152, "min": 0.0152, "max": 0.0152} , "log": "ok", "app": {"version":"v0.15","description":"ALICE pp GEN-SIM","cvmfs_checksum":"9986a9a83745b416a510788e1f35d807","bmkdata_checksum":"b94489e16c0a77f2a0a9aaf333260a96","bmk_checksum":"6c5c2fd1379388c9b1cbd3888e5ecbd3"} }
diff --git a/alice/gen-sim/alice-gen-sim/parseResults.sh b/alice/gen-sim/alice-gen-sim/parseResults.sh
index c4c675f6..df656f08 100644
--- a/alice/gen-sim/alice-gen-sim/parseResults.sh
+++ b/alice/gen-sim/alice-gen-sim/parseResults.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 function generateSummary(){
-  echo -e "{\"copies\":$NCOPIES , \"threads_per_copy\":$NTHREADS , \"events_per_thread\" : $NEVENTS_THREAD , \"CPU_score\": $resJSON , \"log\": \"${s_msg}\", \"app\": `cat $BMKDIR/version.json` }" > ${APP}_summary.json
+  echo -e "{\"copies\":$NCOPIES , \"threads_per_copy\":$NTHREADS , \"events_per_thread\" : $NEVENTS_THREAD , $resJSON , \"log\": \"${s_msg}\", \"app\": `cat $BMKDIR/version.json` }" > ${APP}_summary.json
   cat ${APP}_summary.json
 }
 
@@ -21,7 +21,7 @@ function parseResults(){
   if [ "$1" == "" ] || [ "$2" != "" ]; then echo "[parseresults] ERROR! Invalid arguments '$@' to parseResults"; return 1; fi
   echo "[parseResults] parse results and generate summary (previous status: $1)"
   echo "[parseResults] current directory: $(pwd)"
-  export resJSON='""'
+  export resJSON='"wl-scores":{}'
   export s_msg="ok"
   #-----------------------
   # Parse results
@@ -36,15 +36,16 @@ function parseResults(){
         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 CPU score\""; exit 1)`
+      }; 
+printf "\"wl-scores\": {\"gen-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)`
   STATUS=$?
   echo "[parseResults] checking that all job are completed correctly from" proc_*/out_*.log
   ALL_JOBS_SUCCEED=`grep -c -h -m1 "finished with the expected exit code" proc_*/out_*.log | awk 'BEGIN{sum=0;count=0}{sum+=$1;count+=1}END{print sum==count}'`
   if [ "$ALL_JOBS_SUCCEED" != 1 ]; then
     STATUS=1
     s_msg="[ERROR] There is at least one job not finished properly"
-    resJSON='""'
+    resJSON='"wl-scores":{}'
     grep -c "finished with the expected exit code" proc_*/out_*.log
   fi
   #-----------------------
-- 
GitLab