Tracking Interactive Idle Time
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.
name shortcut type value relop requestable consumable default
If you need more information on how to do this, see the appnote
A Resource To A Host in Grid Engine.
Finally, you need to configure the queue(s) to suspend a queue when the idle time is below 5 minutes (or any length of time) and unsuspend it when it is above. In the main qmon window, click on "Queue Configuration". Highlight a queue running on the desktop workstation and click on "Modify". On the "Load/Suspend Thresholds" tab, under the "Suspend Thresholds" table, click on the "Load" title heading and you will see the "Select an Item" popup window. Choose the idle time resource, (eg, iidle) and click OK. In the "Value" column, enter the thresholds time in hr:min:sec format (eg, five minutes would be 0:5:0). Press Return
The right side of the "Queue Configuration: Modify" window shows the additional paramters "Suspend interval" and "Jobs suspended per interval". Typically, for this kind of setup, you would set the "Jobs suspended per interval" equal to the number of slots in the queue, and the "Suspend interval" equal to some fraction of the Suspend Threshold, eg,1 minute for a 5 or 10 minute Suspend Threshold. NOTE: make sure this is not lower than the "Load Report Time" interval (Qmon --> Cluster Configuration). When you are finished, click OK for the "Queue Configuration: Modify" window.
Now, all jobs running in that queue will get suspended if the mouse or keyboard on the desktop workstation is moved, and will get unsuspended after the mouse and keyboard have been idle for 5 minutes (plus a margin of time equal to the Suspend Interval).
#!/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