From b453c122534c441266db899f3d6ce89ba74a62a8 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Wed, 3 Feb 2021 12:36:59 +0100 Subject: [PATCH] pp: Add automatic launcher --- garlic/index.nix | 4 ++++ garlic/pp/launcher.nix | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 garlic/pp/launcher.nix diff --git a/garlic/index.nix b/garlic/index.nix index 7d5a479..556b85f 100644 --- a/garlic/index.nix +++ b/garlic/index.nix @@ -118,6 +118,10 @@ # Takes a list of experiments and returns a file that contains # all timetable results from the experiments. merge = exps: mergeDatasets (map timetableFromTrebuchet exps); + + # Automatic launcher + launcher = callPackage ./pp/launcher.nix { }; + resultFromLauncher = l: import (builtins.readFile l); }; # Apps for Garlic diff --git a/garlic/pp/launcher.nix b/garlic/pp/launcher.nix new file mode 100644 index 0000000..e362cdb --- /dev/null +++ b/garlic/pp/launcher.nix @@ -0,0 +1,32 @@ +{ + stdenv +}: + +trebuchet: + +stdenv.mkDerivation { + name = "launcher"; + preferLocalBuild = true; + + phases = [ "installPhase" ]; + + installPhase = '' + if [ ! -e /garlic/run ]; then + echo "Missing /garlic/run, cannot continue" + echo "Are you running the garlicd daemon?" + echo + echo "You can manually run the experiment and fetch the results with:" + echo + echo -e "\e[30;48;5;2mgarlic -RFv ${trebuchetStage}\e[0m" + echo + echo "See garlic(1) for more details." + exit 1 + fi + + echo ${trebuchet} >> /garlic/run + echo "Waiting for experiment results..." + results=$(cat /garlic/completed) + #ln -s $results $out + echo -n "$results" > $out + ''; +}