Skip to content

Instantly share code, notes, and snippets.

@dgruber
Created February 22, 2015 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgruber/9ea0332106df0779fb32 to your computer and use it in GitHub Desktop.
Save dgruber/9ea0332106df0779fb32 to your computer and use it in GitHub Desktop.
Univa Grid Engine as a Job
#!/bin/sh
# we need to remember our original cluster
ORG_ROOT=$SGE_ROOT
UGEROOT=/vagrant/
UGEROOT+=$SGE_HGR_GLOBAL_MT_SGE_ROOT
QMASTER_PORT=$SGE_HGR_GLOBAL_MT_QMASTER_PORT
EXECD_PORT=`expr $QMASTER_PORT + 1`
CLUSTER_NAME="p$QMASTER_PORT"
MASTER_SPOOL_DIR=$UGEROOT/default/spool/master
EXECD_SPOOL_DIR=/$SGE_HGR_GLOBAL_MT_EXEC_SPOOL
GID_RANGE="$SGE_HGR_GLOBAL_MT_GID_RANGE-"`expr $SGE_HGR_GLOBAL_MT_GID_RANGE + 200`
HOSTS=`cat $PE_HOSTFILE | awk 'BEGIN{ORS=" ";} {print $1}'`
# make installation directory based on UGE selection
mkdir $UGEROOT
cd $UGEROOT
echo "SGE_ROOT=$UGEROOT" > installation_template
echo 'SGE_QMASTER_PORT="XQMASTER_PORT"
SGE_EXECD_PORT="XEXECD_PORT"
SGE_ENABLE_SMF="false"
SGE_CLUSTER_NAME="XCLUSTER_NAME"
SGE_JMX_PORT="Please enter port"
SGE_JMX_SSL="false"
SGE_JMX_SSL_CLIENT="false"
SGE_JMX_SSL_KEYSTORE="Please enter absolute path of server keystore file"
SGE_JMX_SSL_KEYSTORE_PW="Please enter the server keystore password"
SGE_JVM_LIB_PATH="Please enter absolute path of libjvm.so"
SGE_ADDITIONAL_JVM_ARGS="-Xmx256m"
CELL_NAME="default"
ADMIN_USER=""
QMASTER_SPOOL_DIR="XMASTER_SPOOL_DIR"
EXECD_SPOOL_DIR="XEXECD_SPOOL_DIR"
GID_RANGE="XGID_RANGE"
SPOOLING_METHOD="classic"
DB_SPOOLING_SERVER="none"
DB_SPOOLING_DIR="/opt/tools/uge/mycluster/bdb"
PG_SPOOLING_ARGS="none"
PAR_EXECD_INST_COUNT="20"
ADMIN_HOST_LIST="XHOSTS"
SUBMIT_HOST_LIST="XHOSTS"
EXEC_HOST_LIST="XHOSTS"
EXECD_SPOOL_DIR_LOCAL=""
HOSTNAME_RESOLVING="true"
SHELL_NAME="ssh"
COPY_COMMAND="scp"
DEFAULT_DOMAIN="none"
ADMIN_MAIL="none"
ADD_TO_RC="false"
SET_FILE_PERMS="true"
RESCHEDULE_JOBS="wait"
SCHEDD_CONF="3"
SHADOW_HOST=""
EXEC_HOST_LIST_RM=""
REMOVE_RC="false"
WINDOWS_SUPPORT="false"
WIN_ADMIN_NAME="Administrator"
WIN_DOMAIN_ACCESS="false"
WIN_ADMIN_PASSWORD=""
CSP_RECREATE="true"
CSP_COPY_CERTS="false"
CSP_COUNTRY_CODE="DE"
CSP_STATE="Germany"
CSP_LOCATION="Building"
CSP_ORGA="Organisation"
CSP_ORGA_UNIT="Organisation_unit"' >> installation_template
sed -i "s#XQMASTER_PORT#$QMASTER_PORT#g" installation_template
sed -i "s#XEXECD_PORT#$EXECD_PORT#g" installation_template
sed -i "s#XCLUSTER_NAME#$CLUSTER_NAME#g" installation_template
sed -i "s#XMASTER_SPOOL_DIR#$MASTER_SPOOL_DIR#g" installation_template
sed -i "s#XEXECD_SPOOL_DIR#$EXECD_SPOOL_DIR#g" installation_template
sed -i "s#XGID_RANGE#$GID_RANGE#g" installation_template
sed -i "s#XHOSTS#$HOSTS#g" installation_template
echo "unpacking"
tar zxvfp /vagrant/ge-8.2.0-demo-common.tar.gz
tar zxvfp /vagrant/ge-8.2.0-demo-bin-lx-amd64.tar.gz
echo "installing now"
./inst_sge -m -auto ./installation_template
./inst_sge -x -auto ./installation_template
source default/common/settings.sh
echo "doing some configuration now"
sleep 5
qconf -mattr queue shell /bin/sh all.q
# set submit and config host
qconf -ah master
qconf -as master
echo "accepting jobs now on"
# use outer cluster
source $ORG_ROOT/default/common/settings.sh
$SGE_ROOT/bin/lx-amd64/qalter -ac STATUS=RUNNING $JOB_ID
$SGE_ROOT/bin/lx-amd64/qalter -ac SETTINGS=$UGEROOT $JOB_ID
sleep infinity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment