Don't nest the unit results

The experiment directory now contains symlinks to the units, keeping the
old structure. The unit results are directly placed in the garlic out
directory.
This commit is contained in:
Rodrigo Arias 2020-10-16 15:51:05 +02:00
parent be0506bc21
commit 2680dcb66f
2 changed files with 22 additions and 3 deletions

View File

@ -13,6 +13,9 @@ with garlicTools;
let let
unitsString = builtins.concatStringsSep "\n" unitsString = builtins.concatStringsSep "\n"
(map (x: "${stageProgram x}") units); (map (x: "${stageProgram x}") units);
unitsLinks = builtins.concatStringsSep "\n"
(map (x: "ln -s ../${baseNameOf x} ${baseNameOf x}") units);
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "experiment"; name = "experiment";
@ -30,16 +33,20 @@ stdenv.mkDerivation {
exit 1 exit 1
fi fi
cd "\$GARLIC_OUT"
export GARLIC_EXPERIMENT=$(basename $out) export GARLIC_EXPERIMENT=$(basename $out)
echo "Running experiment \$GARLIC_EXPERIMENT"
if [ -e "\$GARLIC_EXPERIMENT" ]; then if [ -e "\$GARLIC_EXPERIMENT" ]; then
>&2 echo "Already exists \$GARLIC_EXPERIMENT, aborting" >&2 echo "skipping, experiment path already exists: \$GARLIC_EXPERIMENT"
exit 1 exit 0
fi fi
mkdir -p "\$GARLIC_EXPERIMENT" mkdir -p "\$GARLIC_EXPERIMENT"
cd "\$GARLIC_EXPERIMENT" cd "\$GARLIC_EXPERIMENT"
${unitsLinks}
echo "Running experiment \$GARLIC_EXPERIMENT"
# This is an experiment formed by the following units: # This is an experiment formed by the following units:
${unitsString} ${unitsString}

View File

@ -50,9 +50,21 @@ stdenv.mkDerivation {
${desc} ${desc}
if [ -z "\$GARLIC_OUT" ]; then
>&2 echo "GARLIC_OUT not defined, aborting"
exit 1
fi
cd "\$GARLIC_OUT"
# Set the experiment unit in the environment # Set the experiment unit in the environment
export GARLIC_UNIT=$(basename $out) export GARLIC_UNIT=$(basename $out)
if [ -e "\$GARLIC_UNIT" ]; then
>&2 echo "skipping, unit path already exists: \$GARLIC_UNIT"
exit 0
fi
# And change the working directory # And change the working directory
mkdir \$GARLIC_UNIT mkdir \$GARLIC_UNIT
cd \$GARLIC_UNIT cd \$GARLIC_UNIT