bscpkgs/bsc/garlic/dispatcher.nix

33 lines
512 B
Nix
Raw Normal View History

2020-08-05 00:38:33 +08:00
{
stdenv
, jobs
}:
stdenv.mkDerivation {
name = "slurm-dispatcher";
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
cat > $out/bin/execute-all-jobs <<EOF
#!/bin/bash
for j in $out/jobs/*; do
echo "sbatch \$j"
sbatch \$j
done
EOF
chmod +x $out/bin/execute-all-jobs
'';
}