This took me a little while to figure out, so I've decided to post here for anyone interested in getting a single-node batch scheduling system running on Fedora 17 using torque from the fedora repository. These are really just a bunch of notes I took during the process. I have a dual quad-core machine and this just allows me to make use of idle cores. I could (and did orginially) use the linux "batch" command but some of my jobs are CPU-bound and some are I/O-bound. For the latter, I needed a way to strictly limit the number of concurrent jobs running and torque may be overkill, but I like it just the same. Anywho.... here we go.
Of course, if this doesn't work for you or if there are errors, please let me know. Thanks!
Code:
########################################################################
# first make sure you have no installation of torque or pbs on
# your system (use updatedb/locate for the words torque and pbs)
#
# The setup could be done with sudo everywhere or we could simply
# become root...
su -
yum -y install 'torque*'
USER=<your username (not root)>
HOST=`hostname --long`
# you may have to CTRL+C out of this. Not to worry, the file
# you need is created almost immediately after you run it.
pbs_server -t create
# configure manager/operator user
qmgr -c "set server operators += $USER@$HOST"
qmgr -c "set server managers += $USER@$HOST"
# scheduling options
qmgr -c 'set server scheduling = true'
qmgr -c 'set server keep_completed = 300'
# create the default queue called 'batch'
# this will consist of a single node and
# allow a maximum of 7 jobs to be run at
# one time. This was for a dual quad-core
# desktop machine.
qmgr -c 'create queue batch'
qmgr -c 'set queue batch queue_type = execution'
qmgr -c 'set queue batch started = true'
qmgr -c 'set queue batch enabled = true'
qmgr -c 'set queue batch resources_default.walltime = 72:00:00'
qmgr -c 'set queue batch resources_default.nodes = 1'
qmgr -c 'set queue batch max_running = 7'
qmgr -c 'set server default_queue = batch'
# single host configuration
echo $HOST > /etc/torque/server_name
echo '$pbs_server = '$HOST > /etc/torque/mom/config
echo '$pbs_server = '$HOST > /var/lib/torque/mom_priv/config
echo "$HOST np=8" > /var/lib/torque/server_priv/nodes
# start services
systemctl start pbs_{mom,server,sched}.service
# At this point the torque/pbs scheduler and queue system should
# up and running.
########################################################################
# The following should be run as a user (with operator and manager
# priveleges as set in the commands above).
# check that everything looks Ok
qmgr -c "list server"
qmgr -c "list queue batch"
# test a small job (will not work as root!!)
# we cd into $HOME to ensure we have permission
# to write out the output files.
cd $HOME
qsub << EOF
echo `hostname`
echo "Hi I am a batch job running in torque"
EOF
# Other notes
# to have the services run at boot time, do this:
sudo systemctl enable pbs_{mom,server,sched}.service
# to restart all pbs services use this:
sudo systemctl restart pbs_{mom,server,sched}.service
# I found it's generally OK to allow sendmail to have selinux
# read access to torque's serverdb file when it complains.