bscpkgs/garlic/pp/timeResult.nix
Rodrigo Arias Mallo 4beb069627 WIP: postprocessing pipeline
Now each run is executed in a independent folder
2020-11-03 19:09:59 +01:00

31 lines
670 B
Nix

{
stdenv
}:
inputResult:
stdenv.mkDerivation {
name = "timeResult";
preferLocalBuild = true;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out
cd ${inputResult}
for unit in *-experiment/*-unit; do
outunit=$out/$unit
mkdir -p $outunit
# Copy the unit config
conf="$unit/garlic_config.json"
cp "$conf" "$outunit/garlic_config.json"
# Merge all runs in one single CSV file
echo "run time" > $outunit/data.csv
for r in $(cd $unit; ls -d [0-9]* | sort -n); do
log="$unit/$r/stdout.log"
awk "/^time /{print \"$r\", \$2}" $log >> $outunit/data.csv
done
done
'';
}