diff options
author | kris <kris@FreeBSD.org> | 2007-07-30 03:41:52 +0800 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2007-07-30 03:41:52 +0800 |
commit | eef73cd84bfb9bc1d67e8a287671a6943eabcc2d (patch) | |
tree | 7bd017fd94f5fd8bad888932ac53cbb73a8428c3 /Tools/portbuild | |
parent | 19a0ac0c8acc981139a39785a0b7aae181230372 (diff) | |
download | freebsd-ports-gnome-eef73cd84bfb9bc1d67e8a287671a6943eabcc2d.tar.gz freebsd-ports-gnome-eef73cd84bfb9bc1d67e8a287671a6943eabcc2d.tar.zst freebsd-ports-gnome-eef73cd84bfb9bc1d67e8a287671a6943eabcc2d.zip |
* Revise the machine selection algorithm. Previously it chose the first
machine with the lowest number of running jobs. This worked when the
clients were all roughly equivalent, but schedules poorly when there
are some that are much more powerful (e.g. 8-core machines vs UP machines)
* We now compute the ratio of running jobs to maximum jobs and schedule on
the machine with lowest occupation fraction. This populates the machines
to equal fractions of their capacity.
Diffstat (limited to 'Tools/portbuild')
-rwxr-xr-x | Tools/portbuild/scripts/getmachine | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/Tools/portbuild/scripts/getmachine b/Tools/portbuild/scripts/getmachine index 2cc940408a81..fb3e71adecdd 100755 --- a/Tools/portbuild/scripts/getmachine +++ b/Tools/portbuild/scripts/getmachine @@ -17,20 +17,28 @@ if [ "$1" = "*" ]; then exit 1 fi -min=9999 + +min=999999 while [ $# -gt 0 ]; do m=$1 - num=$(cat $m) - if [ $num -lt $min ]; then + + # Pull in maxjobs + . ${pb}/${arch}/portbuild.conf + test -f ${pb}/${arch}/portbuild.${m} && . ${pb}/${arch}/portbuild.${m} + + curjobs=$(cat $m) + weight=$((${curjobs}*1000/${maxjobs})) + + if [ $weight -lt $min ]; then mach=$m - min=$num - elif [ $num -eq $min ]; then + min=$weight + elif [ $weight -eq $min ]; then mach="${mach} ${m}" fi shift done -if [ "$min" = 9999 -o -z "${mach}" ]; then +if [ "$min" = 999999 -o -z "${mach}" ]; then echo "" exit 1 fi @@ -45,11 +53,12 @@ fi . ${pb}/${arch}/portbuild.conf test -f ${pb}/${arch}/portbuild.${mach} && . ${pb}/${arch}/portbuild.${mach} +curjobs=$(cat $mach) # Now that we've found a machine, register our claim in the queue -if [ "$((${min}+1))" -ge "${maxjobs}" ]; then +if [ "$((${curjobs}+1))" -ge "${maxjobs}" ]; then rm ${mach} else - echo $(($min+1)) > ${mach} + echo $(($curjobs+1)) > ${mach} fi # Report to caller |