/usr/bin/sge_submit_workers is in coop-computing-tools 4.0-1.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | #!/bin/sh
show_help()
{
echo "Use: sge_submit_workers [options] <servername> <port> <num-workers>"
echo " when auto mode is not enabled, or"
echo " sge_submit_workers [options] <num-workers>"
echo " when auto mode is enabled."
echo "Options:"
echo " -M,--master-name <name> Name of the preferred master for worker. (auto mode enabled)"
echo " -N,--name <name> Same as -M (backwards compatibility). (auto mode enabled)"
echo " -C,--catalog <catalog> Set catalog server to <catalog>. <catalog> format: HOSTNAME:PORT."
echo " -t,--timeout <time> Abort after this amount of idle time. (default=900s)."
echo " -d,--debug <subsystem> Enable debugging on worker for this subsystem (try -d all to start)."
echo " -w,--tcp-window-size <size> Set TCP window size."
echo " -i,--min-backoff <time> Set initial value for backoff interval when worker fails to connect to a master. (default=1s)"
echo " -b,--max-backoff <time> Set maxmimum value for backoff interval when worker fails to connect to a master. (default=60s)"
echo " -z,--disk-threshold <size> Set available disk space threshold (in MB). When exceeded worker will clean up and reconnect. (default=100MB)"
echo " -A,--arch <arch> Set architecture string for the worker to report to master instead of the value in uname."
echo " -O,--os <os> Set operating system string for the worker to report to master instead of the value in uname."
echo " -s,--workdir <path> Set the location for creating the working directory of the worker."
echo " -P,--password <pwfile> Password file to authenticate workers to master."
echo " --cores <num> Set the number of cores each worker should use (0=auto). (default=1)"
echo " --memory <size> Manually set the amonut of memory (in MB) reported by this worker."
echo " --disk <size> Manually set the amount of disk (in MB) reported by this worker."
echo " -j Use job array to submit workers."
echo " -p <parameters> SGE qsub parameters."
echo " -h,--help Show this help message."
exit 1
}
arguments=""
use_auto=0
use_jobarray=0
parameters=""
cores=1
# Used options (as in the getopts format): aM:N:C:t:d:w:i:b:z:A:O:s:P:jp:h
while [ $# -gt 0 ]
do
case $1 in
-a | --advertise)
#left here for backwards compatibility
arguments="$arguments -a"
use_auto=1
;;
-M | --master-name)
shift
arguments="$arguments -M $1"
use_auto=1
;;
-N | --name)
shift
arguments="$arguments -M $1"
use_auto=1
;;
-C | --catalog)
shift
arguments="$arguments -C $1"
;;
-t | --timeout)
shift
arguments="$arguments -t $1"
;;
-d | --debug)
shift
arguments="$arguments -d $1"
;;
-w | --tcp-window-size)
shift
arguments="$arguments -w $1"
;;
-i | --min-backoff)
shift
arguments="$arguments -i $1"
;;
-b | --max-backoff)
shift
arguments="$arguments -b $1"
;;
-z | --disk-threshold)
shift
arguments="$arguments -z $1"
;;
-A | --arch)
shift
arguments="$arguments -A $1"
;;
-O | --os)
shift
arguments="$arguments -O $1"
;;
-s | --workdir)
shift
arguments="$arguments -s $1"
;;
-P | --password)
shift
pwfile=$1
arguments="$arguments -P $pwfile"
;;
--cores)
shift
cores=$1
arguments="$arguments --cores $cores"
;;
--memory)
shift
arguments="$arguments --memory $1"
;;
--disk)
shift
arguments="$arguments --disk $1"
;;
-j)
use_jobarray=1
;;
-p)
shift
parameters="$parameters $1"
;;
-h | --help)
show_help
;;
*)
break
;;
esac
shift
done
if [ $use_auto = 0 ]; then
if [ $# -ne 3 ] ; then
echo "3 arguments (<servername> <port> <num-workers>) are expected while $# is present: \"$@\"."
echo "To view the help message, type: sge_submit_workers -h"
exit 1
fi
host=$1
port=$2
count=$3
else
if [ $# -ne 1 ]
then
echo "1 argument (<num-workers>) is expected while $# is present: \"$@\"."
echo "To view the help message, type: sge_submit_workers -h"
exit 1
fi
host=
port=
count=$1
fi
worker=`which work_queue_worker 2>/dev/null`
if [ $? != 0 ]
then
echo "$0: please add 'work_queue_worker' to your PATH."
exit 1
fi
qsub=`which qsub 2>/dev/null`
if [ $? != 0 ]
then
echo "$0: please add 'qsub' to your PATH."
exit 1
fi
mkdir -p ${USER}-workers
cd ${USER}-workers
cp $worker .
cat >worker.sh <<EOF
#!/bin/sh
#$ -pe smp $cores
./work_queue_worker $arguments $host $port
EOF
chmod 755 worker.sh
if [ $use_jobarray = 1 ]
then
qsub -t 1-$count:1 -cwd $parameters worker.sh
else
for n in `seq 1 $count`
do
qsub -cwd $parameters worker.sh
done
fi
return_status=$?
exit $return_status
|