Multiple tinderd instances
Joe Marcus Clarke
marcus at marcuscom.com
Sun Aug 3 20:35:05 EDT 2008
On Sat, 2008-08-02 at 02:48 +0100, Tim Bishop wrote:
> On Sat, Aug 02, 2008 at 02:44:52AM +0100, Tim Bishop wrote:
> > The attached patch ...
>
> ... got lost. Here it is inline:
Not really the same as -j, but I can see this being useful.
>
> diff -ruN /usr/local/tinderbox/scripts/etc/rc.d/tinderd.sh scripts/etc/rc.d/tinderd.sh
> --- /usr/local/tinderbox/scripts/etc/rc.d/tinderd.sh 2008-01-17 12:31:39.000000000 +0000
> +++ scripts/etc/rc.d/tinderd.sh 2008-01-17 12:33:18.000000000 +0000
> @@ -24,6 +24,7 @@
> : ${tinderd_enable="NO"}
> : ${tinderd_directory="/space/scripts"}
> : ${tinderd_flags=""}
> +: ${tinderd_instances="1"}
Do you have any rule of thumb on how to scale this? That is, do you
have any documentation on how people could best use this feature?
>
> # path to your executable, might be libxec, bin, sbin, ...
> command="${tinderd_directory}/tinderd"
> @@ -34,4 +35,13 @@
> # extra required arguments
> command_args=">/dev/null &"
>
> +start_cmd="${name}_start"
> +
> +tinderd_start()
> +{
> + for i in `jot - 1 ${tinderd_instances}`; do
> + ${command} ${tinderd_flags} >/dev/null 2>&1 &
> + done
> +}
> +
> run_rc_command "$1"
> diff -ruN /usr/local/tinderbox/scripts/tinderd scripts/tinderd
> --- /usr/local/tinderbox/scripts/tinderd 2008-01-17 12:31:39.000000000 +0000
> +++ scripts/tinderd 2008-01-17 12:33:18.000000000 +0000
> @@ -15,7 +15,22 @@
> main_loop() {
> while true ; do
> trap "" 1
> - ENTRY=$(${pb}/scripts/tc listBuildPortsQueue -s ENQUEUED -r | head -1)
> + ENTRY=""
> +
> + if mkdir /tmp/tinderdlock >/dev/null 2>&1; then
> + ${pb}/scripts/tc listBuildPortsQueue -s ENQUEUED -r > /tmp/tinderd.$$
> + while read line; do
> + BUILD=$(echo ${line} | cut -d: -f3)
> + if [ ! -f $pb/builds/$BUILD/tinderdlock -a ! -f $pb/builds/$BUILD/lock ]; then
> + touch $pb/builds/$BUILD/tinderdlock
> + ENTRY=$line
> + break
> + fi
> + done < /tmp/tinderd.$$
> + rm /tmp/tinderd.$$
> + rmdir /tmp/tinderdlock
> + fi
> +
Why roll your own locking? Why not use lockf? What happens if tinderd
gets killed after it's created /tmp/tinderdlock, but before it's removed
it?
> ID=$(echo ${ENTRY} | cut -d: -f1)
> USER=$(echo ${ENTRY} | cut -d: -f2)
> BUILD=$(echo ${ENTRY} | cut -d: -f3)
> @@ -37,6 +52,8 @@
> fi
>
> ${pb}/scripts/tc reorgBuildPortsQueue
> +
> + rm $pb/builds/$BUILD/tinderdlock
Same goes for this lock.
Joe
--
PGP Key : http://www.marcuscom.com/pgp.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://marcuscom.com/pipermail/tinderbox-list/attachments/20080803/5b1d4e5c/attachment.bin>
More information about the tinderbox-list
mailing list