From e89139284a89a0b527b2d33557aa9d2c1e414b58 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Wed, 3 Feb 2021 12:37:54 +0100 Subject: [PATCH] stdexp: add result and timetable targets These targets allow one experiment to directly refer to another experiment results, thus a dependency chain can be formed to ensure execution order. It also simplifies the dataset definition, as they can be automatically fetched from the experiment directly. --- garlic/index.nix | 2 +- garlic/stdexp.nix | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/garlic/index.nix b/garlic/index.nix index 556b85f..a9b31cb 100644 --- a/garlic/index.nix +++ b/garlic/index.nix @@ -69,7 +69,7 @@ # Load some helper functions to generate app variants stdexp = callPackage ./stdexp.nix { - inherit (bsc.garlic) targetMachine stages; + inherit (bsc.garlic) targetMachine stages pp; }; # Execution stages diff --git a/garlic/stdexp.nix b/garlic/stdexp.nix index bb386ef..e9a9d27 100644 --- a/garlic/stdexp.nix +++ b/garlic/stdexp.nix @@ -8,6 +8,7 @@ , writeTextFile , runCommandLocal , python +, pp }: with stdenv.lib; @@ -19,17 +20,23 @@ in rec { /* Takes a list of units and builds an experiment, after executing the trebuchet, runexp and isolate stages. Returns the trebuchet stage. */ - buildTrebuchet = units: stages.trebuchet { - inherit (machineConf) nixPrefix sshHost; - nextStage = stages.runexp { - inherit (machineConf) nixPrefix; - nextStage = stages.isolate { + buildTrebuchet = units: + let + trebuchet = stages.trebuchet { + inherit (machineConf) nixPrefix sshHost; + nextStage = stages.runexp { inherit (machineConf) nixPrefix; - nextStage = stages.experiment { - inherit units; + nextStage = stages.isolate { + inherit (machineConf) nixPrefix; + nextStage = stages.experiment { + inherit units; + }; }; }; }; + in trebuchet // rec { + result = pp.resultFromLauncher (pp.launcher trebuchet); + timetable = pp.timetable result; }; /* Given an attrset of lists `varConf` and a function `genConf` that accepts a