bscpkgs/garlic/postprocess/result.nix

44 lines
978 B
Nix
Raw Normal View History

2020-10-16 00:48:50 +08:00
{
stdenv
, garlicTools
, fetchExperiment
}:
{
2020-10-16 21:53:28 +08:00
trebuchetStage
, experimentStage
2020-10-16 00:48:50 +08:00
, garlicTemp
}:
with garlicTools;
let
experimentName = baseNameOf (toString experimentStage);
fetcher = fetchExperiment {
sshHost = "mn1";
prefix = "/gpfs/projects/\\\$(id -gn)/\\\$(id -un)/garlic-out";
garlicTemp = "/tmp/garlic-temp";
2020-10-16 21:53:28 +08:00
inherit experimentStage trebuchetStage;
2020-10-16 00:48:50 +08:00
};
in
stdenv.mkDerivation {
name = "result";
preferLocalBuild = true;
__noChroot = true;
phases = [ "installPhase" ];
installPhase = ''
expPath=${garlicTemp}/${experimentName}
if [ ! -e $expPath ]; then
echo "The experiment ${experimentName} is missing in ${garlicTemp}."
echo "Please fetch it and try again."
2020-10-16 21:53:28 +08:00
echo "You can execute ${trebuchetStage} to run the experiment."
2020-10-16 00:48:50 +08:00
echo "And then ${fetcher} to get the results."
exit 1
fi
mkdir -p $out
cp -a ${garlicTemp}/${experimentName} $out
'';
}