Difference between revisions of "User Remote"

From oldwiki.scinet.utoronto.ca
Jump to navigation Jump to search
Line 1: Line 1:
 
__FORCETOC__
 
__FORCETOC__
  
==Remote submitting jobs==
+
==Submitting jobs==
 +
The GPC and P7 job submission commands (<tt>qsub</tt> and <tt>llsubmit</tt>, respectively) do not allow for the submission of multiple job files, leaving the user to have to for-loop through multiple files when batch submission is required. The below bash function automates such looping and can be added to the shell environment
  
==Remote cancel jobs==
+
<pre>
 +
function submit() {
 +
    host=`hostname | awk '/^scinet/ {print 0} /^gpc/ {print 1} /^p7/ {print 2}'`
  
==Remote query running jobs==
+
    if [ $host -eq 0 ]; then  # Login node
 +
        echo "Can't submit from a login node"
 +
        return
 +
    fi 
  
Lorem Ipsum
+
    if [ $host -eq 1 ]; then  # GPC
 +
        submitter=qsub
 +
    elif [ $host -eq 2 ]; then  # P7
 +
        submitter=llsubmit
 +
    fi 
 +
 
 +
    for fpath in "$@"; do
 +
        $submitter "$fpath"
 +
    done
 +
}
 +
 
 +
</pre>
 +
 
 +
===Usage===
 +
 
 +
<pre>
 +
ashwin@gpc-f101n084-ib0 $ ls
 +
job1.sh job2.sh job3.sh
 +
 
 +
ashwin@gpc-f101n084-ib0 $ submit job*.sh
 +
# submits all three job files using qsub
 +
</pre>
 +
 
 +
<pre>
 +
ashwin@gpc-f101n084-ib0 $ ls
 +
job1.ll job2.ll job3.ll
 +
 
 +
ashwin@ashwin@p7n01 $ submit job*.ll
 +
# submits all three job files using qsub
 +
</pre>
 +
 
 +
==Canceling jobs==
 +
 
 +
The GPC and P7 job submission commands (<tt>canceljob</tt> and <tt>llcancel</tt>, respectively) do not allow for the submission of multiple job files, leaving the user to have to for-loop through multiple files when batch submission is required. The below bash function automates such looping and can be added to the shell environment
 +
 
 +
<pre>
 +
function cancel() {
 +
    host=`hostname | awk '/^scinet/ {print 0} /^gpc/ {print 1} /^p7/ {print 2}'`
 +
   
 +
    if [ $host -eq 0 ]; then  # Login node
 +
        echo "Cannot cancel from Login node"
 +
        return
 +
    fi
 +
 
 +
    if [ $host -eq 1 ]; then  # GPC
 +
        canceler=canceljob
 +
    elif [ $host -eq 2 ]; then  # P7
 +
        canceler=llcancel
 +
    fi
 +
 
 +
    for jid in "$@"; do
 +
        $canceler "$jid"
 +
    done
 +
 
 +
}
 +
 
 +
</pre>
 +
 
 +
==Remote/Batch query running jobs==

Revision as of 11:25, 9 February 2018


Submitting jobs

The GPC and P7 job submission commands (qsub and llsubmit, respectively) do not allow for the submission of multiple job files, leaving the user to have to for-loop through multiple files when batch submission is required. The below bash function automates such looping and can be added to the shell environment

function submit() {
    host=`hostname | awk '/^scinet/ {print 0} /^gpc/ {print 1} /^p7/ {print 2}'`

    if [ $host -eq 0 ]; then  # Login node
        echo "Can't submit from a login node"
        return
    fi  

    if [ $host -eq 1 ]; then  # GPC 
        submitter=qsub
    elif [ $host -eq 2 ]; then  # P7
        submitter=llsubmit
    fi  

    for fpath in "$@"; do
        $submitter "$fpath"
    done
}

Usage

ashwin@gpc-f101n084-ib0 $ ls
job1.sh job2.sh job3.sh

ashwin@gpc-f101n084-ib0 $ submit job*.sh
# submits all three job files using qsub
ashwin@gpc-f101n084-ib0 $ ls
job1.ll job2.ll job3.ll

ashwin@ashwin@p7n01 $ submit job*.ll
# submits all three job files using qsub

Canceling jobs

The GPC and P7 job submission commands (canceljob and llcancel, respectively) do not allow for the submission of multiple job files, leaving the user to have to for-loop through multiple files when batch submission is required. The below bash function automates such looping and can be added to the shell environment

function cancel() {
    host=`hostname | awk '/^scinet/ {print 0} /^gpc/ {print 1} /^p7/ {print 2}'`
    
    if [ $host -eq 0 ]; then  # Login node
        echo "Cannot cancel from Login node"
        return
    fi

    if [ $host -eq 1 ]; then  # GPC
        canceler=canceljob
    elif [ $host -eq 2 ]; then  # P7
        canceler=llcancel
    fi

    for jid in "$@"; do
        $canceler "$jid"
    done

}

Remote/Batch query running jobs