Use rsync to fetch only the logs

This commit is contained in:
Rodrigo Arias 2020-10-27 10:47:52 +01:00
parent a66cdb52fb
commit 7b26b59988

View File

@ -1,12 +1,15 @@
{ {
stdenv stdenv
, garlicTools , garlicTools
, rsync
}: }:
{ {
trebuchetStage trebuchetStage
, experimentStage , experimentStage
, garlicTemp , garlicTemp
# We only fetch the config, stdout and stderr by default
, fetchAll ? false
}: }:
with garlicTools; with garlicTools;
@ -14,12 +17,18 @@ with garlicTools;
let let
experimentName = baseNameOf (toString experimentStage); experimentName = baseNameOf (toString experimentStage);
garlicOut = "/mnt/garlic-out"; garlicOut = "/mnt/garlic-out";
rsyncFilter = if (fetchAll) then "" else ''
--include='*/*/garlic_config.json' \
--include='*/*/std*.log' \
--include='*/*/*/std*.log' \
--exclude='*/*/*/*' '';
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "result"; name = "result";
preferLocalBuild = true; preferLocalBuild = true;
__noChroot = true; __noChroot = true;
buildInputs = [ rsync ];
phases = [ "installPhase" ]; phases = [ "installPhase" ];
installPhase = '' installPhase = ''
@ -73,9 +82,10 @@ in
echo "waiting 10 seconds to try again" echo "waiting 10 seconds to try again"
sleep 10 sleep 10
done done
echo "$exp: execution complete" echo "$exp: execution complete, fething results"
mkdir -p $out mkdir -p $out
cp -aL $exp $out #cp -aL $exp $out
rsync -P -rt --copy-links ${rsyncFilter} $exp $out
''; '';
} }