2020-10-15 18:48:50 +02:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
, rsync
|
|
|
|
, openssh
|
|
|
|
, nix
|
|
|
|
, curl
|
|
|
|
, garlicTools
|
|
|
|
}:
|
|
|
|
|
|
|
|
{
|
|
|
|
sshHost
|
|
|
|
, prefix
|
2020-10-16 15:53:28 +02:00
|
|
|
, experimentStage
|
|
|
|
, trebuchetStage
|
2020-10-15 18:48:50 +02:00
|
|
|
, garlicTemp
|
|
|
|
}:
|
|
|
|
|
|
|
|
with garlicTools;
|
|
|
|
|
|
|
|
let
|
|
|
|
experimentName = baseNameOf (toString experimentStage);
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "fetch";
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
|
|
|
buildInputs = [ rsync openssh curl ];
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cat > $out << EOF
|
|
|
|
#!/bin/sh -e
|
|
|
|
mkdir -p ${garlicTemp}
|
|
|
|
export PATH=${rsync}/bin:${openssh}/bin:${nix}/bin
|
|
|
|
rsync -av \
|
2020-10-16 15:53:28 +02:00
|
|
|
--copy-links \
|
2020-10-15 18:48:50 +02:00
|
|
|
--include='*/*/*.log' --include='*/*/*.json' --exclude='*/*/*' \
|
|
|
|
'${sshHost}:${prefix}/${experimentName}' ${garlicTemp}
|
|
|
|
|
2020-10-16 15:53:28 +02:00
|
|
|
res=\$(nix-build -E '(with import ./default.nix; garlic.getExpResult { \
|
|
|
|
experimentStage = "${experimentStage}"; \
|
|
|
|
trebuchetStage = "${trebuchetStage}"; \
|
|
|
|
garlicTemp = "${garlicTemp}"; \
|
|
|
|
})')
|
2020-10-15 18:48:50 +02:00
|
|
|
|
|
|
|
echo "The results for experiment ${experimentName} are at:"
|
|
|
|
echo " \$res"
|
|
|
|
EOF
|
|
|
|
chmod +x $out
|
|
|
|
'';
|
|
|
|
}
|