| | 1 | SGE Commands |
| | 2 | What are some basic SGE commands? |
| | 3 | |
| | 4 | |
| | 5 | Commonly-Used SGE Commands |
| | 6 | qsub Submit a Job |
| | 7 | qstat Determine the Status of a Job |
| | 8 | qstat -t -ext -s r -u (user) Show start time and cpu time for running jobs |
| | 9 | qdel Cancel a job |
| | 10 | qhold Place a hold on a queued job to prevent it from running |
| | 11 | qrls Release a job held with qhold |
| | 12 | qhost Display Node Information |
| | 13 | qmon An X-Windows interface to SGE commands |
| | 14 | |
| | 15 | |
| | 16 | qsub |
| | 17 | The ‘qsub’ command submits a job to the SGE queueing system. |
| | 18 | |
| | 19 | For example, to submit simple.sh script, run: |
| | 20 | |
| | 21 | $ qsub simple.sh |
| | 22 | A message will be displayed with the job ID and job name: |
| | 23 | |
| | 24 | Your job 96606 (“simple.sh”) has been submitted |
| | 25 | Qsub assigns the job to the workstation with the most resources available. When finished, qsub produces 2 files in my home directory (by default): an error file and an output file, e.g.: |
| | 26 | |
| | 27 | simple.sh.e96606 |
| | 28 | simple.sh.o96606 |
| | 29 | ... where ‘e’ indicates ‘error’ and ‘o’ indicates ‘output’. The number in the file name is the job submission number. |
| | 30 | |
| | 31 | qload |
| | 32 | The ‘qload’ command displays SGE job utilization. |
| | 33 | |
| | 34 | It prints a summary of everyone’s submitted jobs, and lists your running jobs with system CPU/memory information. |
| | 35 | qstat |
| | 36 | The ‘qstat’ command displays detailed SGE job information. It has many useful options. For a complete list, run ‘man qstat’ (type ‘q’ to quit). |
| | 37 | |
| | 38 | To list your jobs, use the ‘qstat’ command without any options. |
| | 39 | |
| | 40 | To list everyone’s jobs, use the ‘qstats’ command (which is a shortcut for ‘qstat -f -ne -u \*’). To view the output one page at a time, include the ‘less’ command (type ‘q’ to quit): |
| | 41 | |
| | 42 | $ qstats | less |
| | 43 | The -j option prints detailed information for a specific job. This is useful to identify why a job remains queued, or is in E(rror) state. The syntax is qstat -j <JobID>, for example |
| | 44 | |
| | 45 | $ qstat -j 193013 |
| | 46 | qdel |
| | 47 | The ‘qdel’ command deletes a job from the queue. |
| | 48 | |
| | 49 | To delete all of your jobs: |
| | 50 | |
| | 51 | $ qdel -u $USER |
| | 52 | Note |
| | 53 | |
| | 54 | $USER will be interpreted by the shell as your unix account name. You may use $USER in shell commands and shell scripts instead of your unix account name. |
| | 55 | |
| | 56 | To delete a single job: |
| | 57 | |
| | 58 | $ qdel 6033 |
| | 59 | To delete a specific range of jobs, see for loop iteration. |