2020-10-21 18:18:43 +02:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
, jq
|
|
|
|
}:
|
|
|
|
|
|
|
|
inputResult:
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "timetable.json";
|
|
|
|
preferLocalBuild = true;
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
buildInputs = [ jq ];
|
|
|
|
installPhase = ''
|
|
|
|
touch $out
|
|
|
|
cd ${inputResult}
|
|
|
|
for exp in *-experiment; do
|
|
|
|
cd ${inputResult}/$exp
|
|
|
|
for unit in *-unit; do
|
|
|
|
cd ${inputResult}/$exp/$unit
|
|
|
|
conf=garlic_config.json
|
|
|
|
for run in $(ls -d [0-9]* | sort -n); do
|
2021-02-25 11:18:02 +01:00
|
|
|
echo "processing unit=$unit run=$run"
|
2020-12-17 15:24:23 +01:00
|
|
|
time=$(awk '/^ ?time /{print $2}' $run/stdout.log)
|
2021-02-03 12:27:23 +01:00
|
|
|
if [ -z "$time" ]; then
|
2021-02-03 13:51:24 +01:00
|
|
|
echo "error: cannot match \"time\" line"
|
2021-02-03 12:27:23 +01:00
|
|
|
echo "check stdout log file: ${inputResult}/$exp/$unit/$run/stdout.log"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-02-08 14:14:08 +01:00
|
|
|
start_time=$(cat $run/.garlic/total_time_start)
|
|
|
|
end_time=$(cat $run/.garlic/total_time_end)
|
|
|
|
total_time=$(($end_time - $start_time))
|
|
|
|
jq -cn "{ exp:\"$exp\", unit:\"$unit\", config:inputs, time:$time, run:$run, total_time:$total_time }" $conf >> $out
|
2020-10-21 18:18:43 +02:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
}
|