Friday, January 14, 2011

Helpful commands for Linux cluster job management

qstat

qstat -a

qstat -an

qstat -f : to see full details of a job
gstat -a

finger
qdel

To kill all of your jobs: (queued and running)
for x in `qstat -a | grep 'username' | awk -F. {'print $1'}`;do qdel $x; done


To run a python program script command in a cluster node:


        ####################################################

        # /usr/bin/python   # XY run on linux cluster.
        # Run as $python XY-v1.0.py prg_script(.py)
        # Advantage of the scripts is that this can be used to run XY # in any node processor
        # of the cluster (or any linux cluster with PBS). But 1 job runs only on a single cpu

        import sys, posix, fileinput, string, re

        # XY path installed in your system
        path = "/XY/bin"
        stem = sys.argv[1]
        cwd = posix.getcwd()
        N = 0
        jobname = """%s""" % (stem)
        command = """echo "#PBS -l nodes=1

        #PBS -m ae
        #PBS -M your_e-mail
        #PBS -l walltime=3:00:00
        #PBS -l mem=512mb
        #PBS -S /bin/bash

        cd %s
        %s/bin/xy %s.py" > %s.j
        chmod +x %s.j
        qsub %s.j


        """ % (cwd, path, stem, jobname, jobname, jobname)
        posix.system(command)
         ####################################################

No comments:

Post a Comment