ds: link the resultTree in the dataset

This commit is contained in:
Rodrigo Arias 2021-05-03 12:48:49 +02:00
parent 760787858a
commit 6937ffcfe9
14 changed files with 53 additions and 131 deletions

View File

@ -1,23 +0,0 @@
{
stdenv
, python3
, gzip
}:
resultTree:
stdenv.mkDerivation {
name = "ctf-mode.json.gz";
preferLocalBuild = true;
src = ./mode.py;
phases = [ "unpackPhase" "installPhase" ];
unpackPhase = ''
cp $src mode.py
'';
buildInputs = [ python3 gzip ];
installPhase = ''
python mode.py ${resultTree} | gzip > $out
'';
}

View File

@ -6,17 +6,13 @@
, callPackage
}:
{
std = {
timetable = callPackage ./std/timetable.nix {};
};
rec {
osu = {
latency = callPackage ./osu/latency.nix {};
bw = callPackage ./osu/bw.nix {};
};
py = callPackage ./py.nix {};
perf.stat = callPackage ./perf/stat.nix {};
ctf.mode = callPackage ./ctf/mode.nix {};
std.timetable = py { script = ./std-timetable.py; compress = false; };
osu.latency = py { script = ./osu-latency.py; };
osu.bw = py { script = ./osu-bw.py; };
perf.stat = py { script = ./perf-stat.py; };
ctf.mode = py { script = ./ctf-mode.py; };
}

View File

@ -1,23 +0,0 @@
{
stdenv
, python3
, gzip
}:
resultTree:
stdenv.mkDerivation {
name = "osu-bw.json.gz";
preferLocalBuild = true;
src = ./bw.py;
phases = [ "unpackPhase" "installPhase" ];
unpackPhase = ''
cp $src bw.py
'';
buildInputs = [ python3 gzip ];
installPhase = ''
python bw.py ${resultTree} | gzip > $out
'';
}

View File

@ -1,23 +0,0 @@
{
stdenv
, python3
, gzip
}:
resultTree:
stdenv.mkDerivation {
name = "osu-latency.json.gz";
preferLocalBuild = true;
src = ./latency.py;
phases = [ "unpackPhase" "installPhase" ];
unpackPhase = ''
cp $src latency.py
'';
buildInputs = [ python3 gzip ];
installPhase = ''
python latency.py ${resultTree} | gzip > $out
'';
}

View File

@ -1,23 +0,0 @@
{
stdenv
, python3
, gzip
}:
resultTree:
stdenv.mkDerivation {
name = "perf-stat.json.gz";
preferLocalBuild = true;
src = ./stat.py;
phases = [ "unpackPhase" "installPhase" ];
unpackPhase = ''
cp $src stat.py
'';
buildInputs = [ python3 gzip ];
installPhase = ''
python stat.py ${resultTree} | gzip > $out
'';
}

34
garlic/ds/py.nix Normal file
View File

@ -0,0 +1,34 @@
{
stdenv
, python3
, gzip
}:
{
script,
compress ? true
}:
tree:
stdenv.mkDerivation {
name = "dataset";
preferLocalBuild = true;
phases = [ "installPhase" ];
buildInputs = [ python3 gzip ];
installPhase = ''
mkdir -p $out
ln -s ${tree} $out/tree
ln -s ${script} $out/script
COMPRESS_DATASET=${toString compress}
if [ $COMPRESS_DATASET ]; then
python $out/script $out/tree | gzip > $out/dataset.json.gz
ln -s dataset.json.gz $out/dataset
else
python $out/script $out/tree > $out/dataset.json
ln -s dataset.json $out/dataset
fi
'';
}

View File

@ -1,23 +0,0 @@
{
stdenv
, python3
}:
resultTree:
stdenv.mkDerivation {
name = "timetable.json";
preferLocalBuild = true;
src = ./timetable.py;
phases = [ "unpackPhase" "installPhase" ];
unpackPhase = ''
cp $src timetable.py
'';
buildInputs = [ python3 ];
installPhase = ''
touch $out
python timetable.py ${resultTree} > $out
'';
}

View File

@ -2,15 +2,22 @@
stdenv
}:
experiments:
datasets:
with stdenv.lib;
stdenv.mkDerivation {
name = "merge.json";
name = "merged-dataset";
preferLocalBuild = true;
phases = [ "installPhase" ];
inherit datasets;
installPhase = ''
cat ${concatStringsSep " " experiments} >> $out
mkdir -p $out
n=1
for d in $datasets; do
ln -s $d $out/$n
let n=n+1
cat $d/dataset >> $out/dataset
done
'';
}

View File

@ -144,10 +144,10 @@ in stdenv.mkDerivation {
mkdir -p $out
cd $out
dataset="${dataset}"
dataset=$(readlink -f ${dataset}/dataset)
ln -s $dataset input
Rscript --vanilla ${script} ${dataset} "$out"
Rscript --vanilla ${script} "$dataset" "$out"
# HACK: replace the \minus for a \hyphen to keep the file paths intact, so
# they can be copied to the terminal directly. The StandardEncoding is not