Cool, glad to see someone using that script I wrote. :) btw, `--x11` is a valid srun option if you're using the x11 spank plugin:
https://github.com/hautreux/slurm-spank-x11 Comes in handy for graphical programs we use on our cluster, like R, RStudio, CLC Genomics Workbench, etc. Cheers, Alan On 01/21/2014 07:04 PM, Jonathan Mills wrote: > > One of our administrators, Marcin Sliwowski, took this 'sinteractive' > script by Alan Orth, and modified it to be slightly easier to use. > > > [jonmills@ht1 ~]$ which sinteractive > /usr/local/bin/sinteractive > [jonmills@ht1 ~]$ cat /usr/local/bin/sinteractive > #!/bin/bash > > # Copyright (C) 2013 Alan Orth > # > # This program is free software: you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > # the Free Software Foundation, either version 3 of the License, or > # (at your option) any later version. > # > # This program is distributed in the hope that it will be useful, > # but WITHOUT ANY WARRANTY; without even the implied warranty of > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > # GNU General Public License for more details. > # > # You should have received a copy of the GNU General Public License > # along with this program. If not, see <http://www.gnu.org/licenses/>. > > # > # interactive: Obtain interactive shell with slurm allocation > # > # Basically simulates: > # > # salloc -n1 srun --pty bash > > # defaults > DEF_NUM_CPUS=1 > DEF_PARTITION=batch > DEF_JOB_NAME=interactive > > ###### > > function help() { > echo -e "Usage: `basename $0` [-c] [-p] [-w] [-r] \n" > echo "Optional arguments:" > echo -e "\t -c: number of CPU cores to request (default: > $DEF_NUM_CPUS)" > echo -e "\t -p: partition to run job in (default: $DEF_PARTITION)" > echo -e "\t -w: node to run job in (default: random)" > echo -e "\t -r: allocate resources for the job from the named > reservation (default: none)" > echo -e "\t -J: job name" > > echo -e "\nWritten by: Alan Orth <[email protected]>" > echo -e "Modified by: RCI Admin <[email protected]>" > > exit 0 > } > > function parse_options() { > while getopts ":c:p:w:r:J:" opt; do > case $opt in > c) > # make sure -c is passed a valid integer > if ! [[ "$OPTARG" =~ ^[0-9]+$ ]]; then > help > fi > > NUM_CPUS=$OPTARG > ;; > p) > PARTITION=$OPTARG > ;; > w) > NODE=$OPTARG > ;; > r) > RESERVATION=$OPTARG > ;; > J) > JOB_NAME=$OPTARG > ;; > \?|:) > help > ;; > esac > done > } > > function envsetup() { > SALLOC_BIN=/usr/bin/salloc > > # default is to request 1 CPU, unless more are requested > if [[ $NUM_CPUS -gt $DEF_NUM_CPUS ]]; then > SALLOC_OPTS="-n $NUM_CPUS" > else > SALLOC_OPTS="-n $DEF_NUM_CPUS" > fi > > # check for a job name > if [[ -n "$JOB_NAME" ]]; then > SALLOC_OPTS="$SALLOC_OPTS -J $JOB_NAME" > else > SALLOC_OPTS="$SALLOC_OPTS -J $DEF_JOB_NAME" > fi > > # see if the user specified a partition > if [[ -n "$PARTITION" ]]; then > SALLOC_OPTS="$SALLOC_OPTS -p $PARTITION" > else > SALLOC_OPTS="$SALLOC_OPTS -p $DEF_PARTITION" > fi > > # see if the user specified a node > if [[ -n "$NODE" ]]; then > SALLOC_OPTS="$SALLOC_OPTS -w $NODE" > fi > > # see if the user specified a reservation > if [[ -n "$RESERVATION" ]]; then > SALLOC_OPTS="$SALLOC_OPTS --reservation $RESERVATION" > fi > > # check if we want X11 > # --x11 is not a valid option to srun > #if [[ -n "$DISPLAY" ]]; then > # SRUN_OPTS="--x11 --pty" > # else > # SRUN_OPTS="--pty" > # fi > > > SRUN_OPTS="--pty" > > SRUN_BIN=/usr/bin/srun > > INTERACTIVE_SHELL=/bin/bash > SHELL_OPTS="-i -l" # not sure if needed > } > > # pass the shell's argument array to the parsing function > parse_options "$@" > > # setup the defaults > envsetup > > $SALLOC_BIN $SALLOC_OPTS $SRUN_BIN $SRUN_OPTS $INTERACTIVE_SHELL > > > > > > > On 01/21/2014 11:00 AM, Moe Jette wrote: >> >> One more thing. all of the documentation at llnl.gov is years old. >> Current documentation is at >> http://slurm.schedmd.com >> >> Quoting Jason Bacon <[email protected]>: >> >>> >>> >>> Well, UW-Milwaukee is now officially a SLURM site. SLURM is now the >>> primary RM on two clusters running CentOS 6.5 (formerly LSF) and >>> FreeBSD 9.2 (formerly Torque). >>> >>> One usage question has come up that the FAQ and Google are fuzzy on: >>> How to open a scheduled interactive shell on a compute node. >>> >>> The FAQ at https://computing.llnl.gov/linux/slurm/faq.html#prompt >>> seems to be incomplete, stating >>> >>> srun -u bash -i >>> >>> Without --pty, though, editors and the like won't work. >>> >>> I came across another site suggesting >>> >>> salloc -n1 srun -n1 -N1 --pty --preserve-env $SHELL >>> >>> The salloc seems redundant to me, but maybe there's some advantage I'm >>> unaware of. Wouldn't this >>> be exactly the same? >>> >>> srun -n1 -N1 --pty --preserve-env $SHELL >>> >>> Thanks, >>> >>> Jason >>> >> > -- Alan Orth [email protected] http://alaninkenya.org http://mjanja.co.ke "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." -Bjarne Stroustrup, inventor of C++ GPG Public Key: 0xf92c4bd91084bb5de14e20be9470dd588dd1026c
signature.asc
Description: OpenPGP digital signature
