This note explains how to set up Grid Engine to track interactive
idle time for desktop workstations. This is useful if you want to use
desktop workstations only when the owner is not using it. If the
owner returns and moves the mouse, the queue on this host is
suspended along with the jobs currently running. When the system is
again idle for 5 minutes (or any other amount of time), the jobs on
the host will be resumed.
It is necessary to first add the
attribute to the host complex:
iidle ii DOUBLE infinity <= NO NO 0
If you need more information on how to do this, see the appnote
Attaching A Resource To A Host
in Grid Engine.
Then, you need to have a script (load
sensor) to keep track of the current idle time on each host. A sample
script is included below.
Finally, in the main qmon window,
click on "Cluster Configuration". Highlight either
"global", or only certain hosts for this to run on, then
click on "Modify". On the "General Settings" tab,
add the path and name of the load sensor program to the load sensor
box. Once OK is pressed, the load sensor will be automatically
started on each host. This may take several minutes.
#!/bin/sh
# (c) 2000 Sun Microsystems, Inc
#
# idle.sh
#
# report interactive inactivity in seconds for SOLARIS 2.X
#
# invariant values
myhost=`hostname`
ARC=`$SGE_ROOT/util/arch`
end=false
while [ $end = false ]; do
# ----------------------------------------
# wait for an input
#
read input
if [ $? != 0 ]; then
end=true
break
fi
if [ "$input" = "quit" ]; then
end=true
break
fi
# "filestat -atime" returns time of last access of given file
# in seconds since 1/1/1970
#
kbdtime=`$SGE_ROOT/utilbin/$ARC/filestat -atime /dev/kbd`
mousetime=`$SGE_ROOT/utilbin/$ARC/filestat -atime /dev/mouse`
# "now" returns current time in seconds since 1/1/1970
#
now=`$SGE_ROOT/utilbin/$ARC/now`
if [ "$kbdtime" -gt "$mousetime" ]; then
idletime=`expr "$now" - "$kbdtime"`
else
idletime=`expr "$now" - "$mousetime"`
fi
echo "begin"
echo "$myhost:iidle:$idletime"
echo "end"
done
|