1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00

* The build hooks used to implement distributed builds can now be run

in parallel.  Hooks are more efficient: locks on output paths are
  only acquired when the hook says that it is willing to accept a
  build job.  Hooks now work in two phases.  First, they should first
  tell Nix whether they are willing to accept a job.  Nix guarantuees
  that no two hooks will ever be in the first phase at the same time
  (this simplifies the implementation of hooks, since they don't have
  to perform locking (?)).  Second, if they accept a job, they are
  then responsible for building it (on the remote system), and copying
  the result back.  These can be run in parallel with other hooks and
  locally executed jobs.

  The implementation is a bit messy right now, though.  

* The directory `distributed' shows a (hacky) example of a hook that
  distributes build jobs over a set of machines listed in a
  configuration file.
This commit is contained in:
Eelco Dolstra 2004-05-13 19:14:49 +00:00
parent 5087c8f645
commit a8306cb98f
9 changed files with 502 additions and 148 deletions

View file

@ -18,8 +18,10 @@ locking.sh: locking.nix
parallel.sh: parallel.nix
build-hook.sh: build-hook.nix
TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh \
build-hook.sh
TESTS = init.sh build-hook.sh
#TESTS = init.sh simple.sh dependencies.sh locking.sh parallel.sh \
# build-hook.sh
XFAIL_TESTS =

View file

@ -1,17 +1,21 @@
#! /bin/sh
set -x
drv=$1
drv=$4
echo "HOOK for $drv"
echo "HOOK for $drv" >&2
outPath=$(sed 's/Derive(\[\"\([^\"]*\)\".*/\1/' $drv)
echo "output path is $outPath"
echo "output path is $outPath" >&2
if $(echo $outPath | grep -q input-1); then
echo "accept" >&3
read x <&4
echo "got $x"
mkdir $outPath
echo "BAR" > $outPath/foo
exit 100
else
echo "decline" >&3
fi
exit 101

View file

@ -1,4 +1,4 @@
export NIX_BUILD_HOOK="sh build-hook.hook.sh"
export NIX_BUILD_HOOK="build-hook.hook.sh"
storeExpr=$($TOP/src/nix-instantiate/nix-instantiate build-hook.nix)

View file

@ -2,7 +2,7 @@ storeExpr=$($TOP/src/nix-instantiate/nix-instantiate parallel.nix)
echo "store expr is $storeExpr"
outPath=$($TOP/src/nix-store/nix-store -qnfvvvv -j0 "$storeExpr")
outPath=$($TOP/src/nix-store/nix-store -qnfvvvv -j10000 "$storeExpr")
echo "output path is $outPath"