SGE Style Load Sensors
vovtaskers also support SGE style load sensors. Use option -L in vovtasker/vovtaskerroot to define the command line for the load sensor.
For
example:
% cp $VOVDIR/etc/tasker_scripts/load_sensor_example.sh /tmp/myloadsensor.sh
% vovtaskerroot -L /tmp/myloadsensor.sh
For security reasons, a load sensor is accepted only if it is owned either by the user or by root.
Load sensors summary:
- vovtasker option
- -L full_path_to_load_sensor
- taskers.tcl file
- -loadsensor full_path_to_load_sensor
Execution
The tasker executes the load sensor:
- Every minute
- After the termination of a job
Special Variables
The implementation recognizes the following special variable names:
Variable name | Description |
---|---|
power | Overrides the effective power of the tasker. |
maxload | Overrides the predefined value of max load allowed by the tasker. |
All other variable names are added to the resource list for the tasker that is executing the load sensor.
Example of a Load Sensor
The following example can be found in $VOVDIR/etc/tasker_scripts/load_sensor_example.sh.
#!/bin/sh
### This is the classical example of a load sensor for SGE.
### Usage: % vovtasker -L /full/path/to/load/sensor
myhost=`uname -n | awk -F. '{print $1}'`
myid=`id -u`
while [ 1 ]; do
# wait for input
read input
result=$?
if [ $result != 0 ]; then
exit 1
fi
if [ "$input" == quit ]; then
exit 0
fi
echo "Computing load sensor: $input"
#
# Send:
# 1. Number of users logged in
# 2. Another number, just for fun.
# 3. Change the power of the tasker to affect the preference
#
logins=`who | cut -f1 -d" " | sort | uniq | wc -l`
logins=`/bin/echo $logins` # Trim left white space.
echo begin
echo "$myhost:logins:$logins"
echo "$myhost:id:$myid"
echo "$myhost:power:42222"
echo end
done
# We never get here.
exit 0