From edf429c932ae8f33aa6c45786d60ce93dbfec6cb Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 22 Sep 2020 17:39:26 +0200 Subject: [PATCH] Avoid loading .bashrc --- garlic/exp/saiph/numcomm.nix | 20 ++++++++++++++++++-- garlic/stages/argv.nix | 2 +- garlic/stages/broom.nix | 23 +++++++++++++++++++++++ garlic/stages/control.nix | 1 - garlic/stages/envRecord.nix | 25 +++++++++++++++++++++++++ garlic/stages/extrae.nix | 3 +-- garlic/stages/nix-setup.nix | 3 ++- garlic/stages/perf.nix | 2 +- garlic/stages/statspy.nix | 2 +- 9 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 garlic/stages/broom.nix create mode 100644 garlic/stages/envRecord.nix diff --git a/garlic/exp/saiph/numcomm.nix b/garlic/exp/saiph/numcomm.nix index 541ab0f..7bc37fc 100644 --- a/garlic/exp/saiph/numcomm.nix +++ b/garlic/exp/saiph/numcomm.nix @@ -74,6 +74,7 @@ let nixsetup = {stage, conf, ...}: with conf; w.nixsetup { program = stageProgram stage; + nixsetup = "${nixPrefix}/bin/nix-setup"; }; extrae = {stage, conf, ...}: @@ -102,6 +103,14 @@ let ]; }; + # Print the environment to ensure we don't get anything nasty + envRecord = {stage, conf, ...}: w.envRecord { + program = stageProgram stage; + }; + + broom = {stage, conf, ...}: w.broom { + program = stageProgram stage; + }; # We may be able to use overlays by invoking the fix function directly, but we # have to get the definition of the bsc packages and the garlic ones as # overlays. @@ -119,11 +128,18 @@ let }; stages = with common; [] + # Cleans ALL environment variables + ++ [ broom ] + # Use sbatch to request resources first ++ optional enableSbatch sbatch - # Repeats the next stages N times - ++ optionals enableControl [ nixsetup control ] + # Record the current env vars set by SLURM to verify we don't have something + # nasty (like sourcing .bashrc). Take a look at #26 + ++ [ envRecord ] + + # Repeats the next stages N=30 times + ++ optional enableControl control # Executes srun to launch the program in the requested nodes, and # immediately after enters the nix environment again, as slurmstepd launches diff --git a/garlic/stages/argv.nix b/garlic/stages/argv.nix index 5060661..e879851 100644 --- a/garlic/stages/argv.nix +++ b/garlic/stages/argv.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { phases = [ "installPhase" ]; installPhase = '' cat > $out < $out < $out < $out < $out < $out < $out/bin/${name} < ${outputDir}/statspy.\$(date +%s.%3N).begin