bscpkgs/bsc/garlic/sbatch-launcher.nix

34 lines
476 B
Nix
Raw Normal View History

2020-08-04 18:38:33 +02:00
{
stdenv
}:
2020-08-10 15:27:46 +02:00
jobs:
2020-08-04 18:38:33 +02:00
stdenv.mkDerivation {
2020-08-10 15:27:46 +02:00
name = "launcher";
2020-08-04 18:38:33 +02:00
preferLocalBuild = true;
buildInputs = [] ++ jobs;
jobs = jobs;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/jobs
for j in $jobs; do
ln -s $j/job $out/jobs/$(basename $j)
done
mkdir -p $out/bin
2020-08-10 15:27:46 +02:00
cat > $out/bin/run <<EOF
#!/bin/sh
2020-08-04 18:38:33 +02:00
for j in $out/jobs/*; do
echo "sbatch \$j"
sbatch \$j
done
EOF
2020-08-10 15:27:46 +02:00
chmod +x $out/bin/run
2020-08-04 18:38:33 +02:00
'';
}