Skip to content

Instantly share code, notes, and snippets.

@informationsea
Created September 5, 2016 14:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save informationsea/af9d2b4a72107a9186cfba1f751dc720 to your computer and use it in GitHub Desktop.
Save informationsea/af9d2b4a72107a9186cfba1f751dc720 to your computer and use it in GitHub Desktop.
Support Function for GridEngine
function qsub-one () {
SHOWHELP="false"
GRID_OPTION=("-cwd")
GRID_SHELL="/bin/zsh"
while getopts p:n:m:hs: OPT; do
case $OPT in
"h") SHOWHELP="true";;
"n") GRID_NAME="$OPTARG";;
"m") GRID_OPTION=("${GRID_OPTION[@]}" "-l" "s_vmem=$OPTARG,mem_req=$OPTARG");;
"p") GRID_OPTION=("${GRID_OPTION[@]}" "-pe" "def_slot" "$OPTARG");;
"s") GRID_SHELL="$OPTARG";;
esac
done
shift $((OPTIND -1 ))
if [ -z "$GRID_NAME" ];then
GRID_NAME=$1
fi
GRID_OPTION=("${GRID_OPTION[@]}" "-S" "$GRID_SHELL" "-N" "$GRID_NAME")
if [[ -z $1 ]]; then
SHOWHELP=true
fi
if [[ "$SHOWHELP" = "true" ]];then
echo "$0 [options] command ..."
echo
echo " -h : show this help"
echo " -n NAME : job name"
echo " -m MEMORY : Memory size with unit"
echo " -p THREADS : # of threds"
echo " "
return 1
fi
echo -e "export PATH=\"$PATH\"\nexport LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"\n"'"$@"'|qsub $GRID_OPTION -- "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment