Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SGE qsub usage
03-17-2016, 02:13 PM (This post was last modified: 06-29-2018 05:44 PM by rayluk.)
Post: #1
SGE qsub usage
Submit Jobs

To submit a job, the user ID of the user must be larger than 100, which means you cannot use root user to submit a job.

We can use qsub command provided by SGE to submit jobs. this command should be executed on the 'submit' node, in general, the sge master node also is the 'submit' node.

The common usage is :
Code:
qsub -cwd $script_name
This will submit $script_name to SGE.
Use -cwd to specify current dir is the work dir.


There are a lot of other options you can use of qsub command, to control memory usage, cpu usage, output files and so on.
One common usage is to put those options into the beginning of your script, like exp.sh:
Quote:#!/bin/bash
#$ -N example_name
#$ -w e
#$ -V
#$ -l h_vmem=2G
#$ -wd /thinker/data/shufang/test
#$ -o /thinker/data/shufang/test/out.log
#$ -e /thinker/data/shufang/test/err.log

...
Then you just need to submit it by:
Code:
$ qsub ./exp.sh

Monitor jobs

To check the status of submitted jobs, you can use the qstat command.
Code:
[shufang@limbo1-1 root]$ qstat -u hututa
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
-----------------------------------------------------------------------------------------------------------------
     92 0.55500 abc.sh     hututa      r     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     93 0.55500 abc.sh     hututa      r     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     94 0.55500 abc.sh     hututa      r     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     95 0.55500 abc.sh     hututa      r     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     96 0.55500 abc.sh     hututa      t     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     97 0.55500 abc.sh     hututa      t     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     98 0.55500 abc.sh     hututa      qw    06/29/2018 13:26:32                                    1        
     99 0.00000 abc.sh     hututa      qw    06/29/2018 13:26:33                                    1

To check the jobs of any users, you can use "*" for the user name
Code:
[shufang@limbo1-1 root]$ qstat -u "*"
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
-----------------------------------------------------------------------------------------------------------------
    101 0.55500 abc.sh     shufang   r     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    102 0.55500 abc.sh     shufang   r     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    103 0.55500 abc.sh     hututa      r     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    104 0.55500 abc.sh     shufang   r     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    105 0.55500 abc.sh     hututa      t     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    106 0.55500 abc.sh     shufang   t     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    107 0.55500 abc.sh     hututa      qw    06/29/2018 13:27:40                                    1        
    108 0.55500 abc.sh     shufang   qw    06/29/2018 13:27:40                                    1        
    109 0.55500 abc.sh     hututa      qw    06/29/2018 13:27:41                                    1        
    110 0.55500 abc.sh     shufang   qw    06/29/2018 13:27:41                                    1        
    111 0.55500 abc.sh     hututa      qw    06/29/2018 13:27:42                                    1        
    112 0.55500 abc.sh     shufang   qw    06/29/2018 13:27:42                                    1        
    113 0.55500 abc.sh     hututa      qw    06/29/2018 13:27:43                                    1        
    114 0.55500 abc.sh     shufang   qw    06/29/2018 13:27:43                                    1        
    115 0.55500 abc.sh     hututa      qw    06/29/2018 13:27:44                                    1        
    116 0.55500 abc.sh     shufang   qw    06/29/2018 13:27:44                                    1        
    117 0.55500 abc.sh     hututa      qw    06/29/2018 13:27:45                                    1        
    118 0.55500 abc.sh     hututa      qw    06/29/2018 13:27:46                                    1        
    119 0.55500 abc.sh     hututa      qw    06/29/2018 13:27:47                                    1

Remove Jobs

To remove a job, you can use qdel
Code:
[shufang@limbo1-1 root]$ qdel 207
shufang has deleted job 207
Quote this message in a reply
03-22-2016, 05:20 PM
Post: #2
RE: SGE qusb usage
there's a parameter to indicate the priority : -p

info from man qsub:

"
Defines or redefines the priority of the job relative to other jobs. Priority is an integer in the range -1023 to 1024. The default priority value for jobs is 0.
Users may only decrease the priority of their jobs. Sun Grid Engine managers and administrators may also increase the priority associated with jobs. If a pending job has higher priority, it is earlier eligible for being dispatched by the Sun Grid Engine scheduler.
If this option or a corresponding value in qmon is specified and the priority is not 0 then this value will be passed to defined JSV instances as parameter with the name p. (see -jsv option above or find more information concerning JSV in jsv(1))


example:

qsub -p 100 ./test.sh #with priority 100
qsub -p 101 ./test2.sh # with priority 101

test2.sh will be execed before test.sh

if there's no -p value assign, just 0. So if there's a task need to
Quote this message in a reply
03-24-2016, 12:52 AM
Post: #3
RE: SGE qusb usage
(03-22-2016 05:20 PM)xwcwt Wrote:  there's a parameter to indicate the priority : -p

info from man qsub:

"
Defines or redefines the priority of the job relative to other jobs. Priority is an integer in the range -1023 to 1024. The default priority value for jobs is 0.
Users may only decrease the priority of their jobs. Sun Grid Engine managers and administrators may also increase the priority associated with jobs. If a pending job has higher priority, it is earlier eligible for being dispatched by the Sun Grid Engine scheduler.
If this option or a corresponding value in qmon is specified and the priority is not 0 then this value will be passed to defined JSV instances as parameter with the name p. (see -jsv option above or find more information concerning JSV in jsv(1))


example:

qsub -p 100 ./test.sh #with priority 100
qsub -p 101 ./test2.sh # with priority 101

test2.sh will be execed before test.sh

if there's no -p value assign, just 0. So if there's a task need to


good good study and day day up!
Find all posts by this user
Quote this message in a reply
06-29-2018, 01:20 PM
Post: #4
RE: SGE qusb usage
Save a copy.

The content in headpost is not correct as tested. The command should be qsub.

(03-17-2016 02:13 PM)xwcwt Wrote:  we can use qsub command provided by SGE to submit tasks. this command should be executed on the 'submit' node, in general, the sge master node also is 'submit'.

the common usage is :
Code:
qusb -cwd $script_name  #use cwd to spefiy current dir is the work dir

this will submit $script_name to the exec list. also, there should be #!/bin/bash at the head of script.

Also, user can submit the task into specify queue:
Code:
qusb -cwd -q $queuename $script_name


$queuename is the name of one queue exists in a sge system.

Examples:

qusb -cwd sgetest.sh
qusb -cwd -q sge.q sgetest.sh

the output of the script can be found the dir submitted or user home dir, the name will like $script_name.o$jodid, where $jobid is the job submit id. the id info can gain when sub.
Find all posts by this user
Quote this message in a reply
06-29-2018, 01:28 PM (This post was last modified: 06-29-2018 01:31 PM by rayluk.)
Post: #5
RE: SGE qusb usage
RR xinjie,

I suggest we update the headpost to be as follows then let GuAo refer to this as the usage of SGE.

(( -> Submiting tasks ))
(( -> To submit a task, the user ID of the user must be bigger then 100, which means you cannot use root user to submit a task. ))
We can use qsub command provided by SGE to submit tasks. this command should be executed on the 'submit' node, in general, the sge master node also is 'submit'.

The common usage is :
Code:
(( qusb -> qsub )) -cwd $script_name  #use cwd to spefiy current dir is the work dir

This will submit $script_name to the exec list. also, there should be #!/bin/bash at the head of script.

Also, user can submit the task into specify queue:
Code:
(( qusb -> qsub )) -cwd -q $queuename $script_name


$queuename is the name of one queue exists in a sge system.

Examples:

(( qusb -> qsub )) -cwd sgetest.sh
(( qusb -> qsub )) -cwd -q sge.q sgetest.sh

The output of the script can be found the dir submitted or user home dir, the name will like $script_name.o$jodid, where $jobid is the job submit id. the id info can gain when sub.


(( -> Running and pending tasks
To look at the jobs in the queue or running, you can use the qstat command.
Code:
[gene@limbo1-1 root]$ qstat -u sage
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
-----------------------------------------------------------------------------------------------------------------
     92 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     93 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     94 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     95 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     96 0.55500 abc.sh     sage         t     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     97 0.55500 abc.sh     sage         t     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     98 0.55500 abc.sh     sage         qw    06/29/2018 13:26:32                                    1        
     99 0.00000 abc.sh     sage         qw    06/29/2018 13:26:33                                    1

To look for jobs run by any users, you can use "*" for the user name
Code:
[gene@limbo1-1 root]$ qstat -u "*"
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
-----------------------------------------------------------------------------------------------------------------
    101 0.55500 abc.sh     sage         r     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    102 0.55500 abc.sh     sage         r     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    103 0.55500 abc.sh     gene         r     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    104 0.55500 abc.sh     sage         r     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    105 0.55500 abc.sh     gene         t     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    106 0.55500 abc.sh     sage         t     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    107 0.55500 abc.sh     gene         qw    06/29/2018 13:27:40                                    1        
    108 0.55500 abc.sh     sage         qw    06/29/2018 13:27:40                                    1        
    109 0.55500 abc.sh     gene         qw    06/29/2018 13:27:41                                    1        
    110 0.55500 abc.sh     sage         qw    06/29/2018 13:27:41                                    1        
    111 0.55500 abc.sh     gene         qw    06/29/2018 13:27:42                                    1        
    112 0.55500 abc.sh     sage         qw    06/29/2018 13:27:42                                    1        
    113 0.55500 abc.sh     gene         qw    06/29/2018 13:27:43                                    1        
    114 0.55500 abc.sh     sage         qw    06/29/2018 13:27:43                                    1        
    115 0.55500 abc.sh     gene         qw    06/29/2018 13:27:44                                    1        
    116 0.55500 abc.sh     sage         qw    06/29/2018 13:27:44                                    1        
    117 0.55500 abc.sh     gene         qw    06/29/2018 13:27:45                                    1        
    118 0.55500 abc.sh     gene         qw    06/29/2018 13:27:46                                    1        
    119 0.55500 abc.sh     gene         qw    06/29/2018 13:27:47                                    1

Removing Jobs
To remove a job, you can use qdel
Code:
[gene@limbo1-1 root]$ qdel 207
gene has deleted job 207
))
Find all posts by this user
Quote this message in a reply
06-29-2018, 05:21 PM (This post was last modified: 06-29-2018 05:22 PM by YU_Xinjie.)
Post: #6
RE: SGE qusb usage
RR rayluk

I am revising the doc based on your proposal. Please review.

We should consider how customer would use the qsub. The example is not very good. I am replacing the example to another one.

(06-29-2018 01:28 PM)rayluk Wrote:  Submit((ing->)) tasks

To submit a task, the user ID of the user must be ((bigger then->larger than)) 100, which means you cannot use root user to submit a task.

We can use qsub command provided by SGE to submit tasks. this command should be executed on the 'submit' node, in general, the sge master node also is ((->the)) 'submit' ((->node)).

The common usage is :
Code:
qsub -cwd $script_name  ((#use cwd to spefiy current dir is the work dir->))

This will submit $script_name to ((the exec list->SGE)).
((->Use -cwd to specify current dir is the work dir.))

((
also, there should be #!/bin/bash at the head of script

Also, user can submit the task into specify queue:
Code:
qsub -cwd -q $queuename $script_name


$queuename is the name of one queue exists in a sge system.

Examples:

qsub -cwd sgetest.sh
qsub -cwd -q sge.q sgetest.sh

The output of the script can be found the dir submitted or user home dir, the name will like $script_name.o$jodid, where $jobid is the job submit id. the id info can gain when sub.
->
There are a lot of other options you can use of qsub command, to control memory usage, cpu usage, output files and so on.
One common usage is to put those options into the beginning of your script, like exp.sh:
Quote:#!/bin/bash
#$ -N example_name
#$ -w e
#$ -V
#$ -l h_vmem=2G
#$ -wd /thinker/data/shufang/test
#$ -o /thinker/data/shufang/test/out.log
#$ -e /thinker/data/shufang/test/err.log

...
Then you just need to submit it by:
Code:
$ qsub ./exp.sh
))

((((Running and pending->Monitor)) tasks

To ((look at the jobs in the queue or running->check the status of submitted jobs)), you can use the qstat command.
Code:
[gene@limbo1-1 root]$ qstat -u sage
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
-----------------------------------------------------------------------------------------------------------------
     92 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     93 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     94 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     95 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     96 0.55500 abc.sh     sage         t     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     97 0.55500 abc.sh     sage         t     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     98 0.55500 abc.sh     sage         qw    06/29/2018 13:26:32                                    1        
     99 0.00000 abc.sh     sage         qw    06/29/2018 13:26:33                                    1

To ((look for->check the)) jobs ((run by-> of)) any users, you can use "*" for the user name
Code:
[gene@limbo1-1 root]$ qstat -u "*"
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
-----------------------------------------------------------------------------------------------------------------
    101 0.55500 abc.sh     sage         r     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    102 0.55500 abc.sh     sage         r     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    103 0.55500 abc.sh     gene         r     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    104 0.55500 abc.sh     sage         r     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    105 0.55500 abc.sh     gene         t     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    106 0.55500 abc.sh     sage         t     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    107 0.55500 abc.sh     gene         qw    06/29/2018 13:27:40                                    1        
    108 0.55500 abc.sh     sage         qw    06/29/2018 13:27:40                                    1        
    109 0.55500 abc.sh     gene         qw    06/29/2018 13:27:41                                    1        
    110 0.55500 abc.sh     sage         qw    06/29/2018 13:27:41                                    1        
    111 0.55500 abc.sh     gene         qw    06/29/2018 13:27:42                                    1        
    112 0.55500 abc.sh     sage         qw    06/29/2018 13:27:42                                    1        
    113 0.55500 abc.sh     gene         qw    06/29/2018 13:27:43                                    1        
    114 0.55500 abc.sh     sage         qw    06/29/2018 13:27:43                                    1        
    115 0.55500 abc.sh     gene         qw    06/29/2018 13:27:44                                    1        
    116 0.55500 abc.sh     sage         qw    06/29/2018 13:27:44                                    1        
    117 0.55500 abc.sh     gene         qw    06/29/2018 13:27:45                                    1        
    118 0.55500 abc.sh     gene         qw    06/29/2018 13:27:46                                    1        
    119 0.55500 abc.sh     gene         qw    06/29/2018 13:27:47                                    1

Remov((ing->e)) Jobs

To remove a job, you can use qdel
Code:
[gene@limbo1-1 root]$ qdel 207
gene has deleted job 207

1. And replace the user "gene" & "sage" by names like "shufang" or others.
Because we do not want user to use "gene" or "sage" to run their jobs. It may mislead them.

2. I am not sure what the relationship between job & task. It sounds a job can contain a set of tasks.
Please check the difference, and correct the "job" & "task" in the doc.
Find all posts by this user
Quote this message in a reply
06-29-2018, 05:32 PM (This post was last modified: 06-29-2018 05:38 PM by rayluk.)
Post: #7
RE: SGE qusb usage
(06-29-2018 05:21 PM)YU_Xinjie Wrote:  RR rayluk

I am revising the doc based on your proposal. Please review.

We should consider how customer would use the qsub. The example is not very good. I am replacing the example to another one.

(06-29-2018 01:28 PM)rayluk Wrote:  Submit((ing->)) tasks

To submit a task, the user ID of the user must be ((bigger then->larger than)) 100, which means you cannot use root user to submit a task.

We can use qsub command provided by SGE to submit tasks. this command should be executed on the 'submit' node, in general, the sge master node also is ((->the)) 'submit' ((->node)).

The common usage is :
Code:
qsub -cwd $script_name  ((#use cwd to spefiy current dir is the work dir->))

This will submit $script_name to ((the exec list->SGE)).
((->Use -cwd to specify current dir is the work dir.))

((
also, there should be #!/bin/bash at the head of script

Also, user can submit the task into specify queue:
Code:
qsub -cwd -q $queuename $script_name


$queuename is the name of one queue exists in a sge system.

Examples:

qsub -cwd sgetest.sh
qsub -cwd -q sge.q sgetest.sh

The output of the script can be found the dir submitted or user home dir, the name will like $script_name.o$jodid, where $jobid is the job submit id. the id info can gain when sub.
->
There are a lot of other options you can use of qsub command, to control memory usage, cpu usage, output files and so on.
One common usage is to put those options into the beginning of your script, like exp.sh:
Quote:#!/bin/bash
#$ -N example_name
#$ -w e
#$ -V
#$ -l h_vmem=2G
#$ -wd /thinker/data/shufang/test
#$ -o /thinker/data/shufang/test/out.log
#$ -e /thinker/data/shufang/test/err.log

...
Then you just need to submit it by:
Code:
$ qsub ./exp.sh
))

((((Running and pending->Monitor)) tasks

To ((look at the jobs in the queue or running->check the status of submitted jobs)), you can use the qstat command.
Code:
[gene@limbo1-1 root]$ qstat -u sage
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
-----------------------------------------------------------------------------------------------------------------
     92 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     93 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     94 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     95 0.55500 abc.sh     sage         r     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     96 0.55500 abc.sh     sage         t     06/29/2018 13:26:33 all.q@limbo1-3                     1        
     97 0.55500 abc.sh     sage         t     06/29/2018 13:26:33 all.q@limbo1-2                     1        
     98 0.55500 abc.sh     sage         qw    06/29/2018 13:26:32                                    1        
     99 0.00000 abc.sh     sage         qw    06/29/2018 13:26:33                                    1

To ((look for->check the)) jobs ((run by-> of)) any users, you can use "*" for the user name
Code:
[gene@limbo1-1 root]$ qstat -u "*"
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
-----------------------------------------------------------------------------------------------------------------
    101 0.55500 abc.sh     sage         r     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    102 0.55500 abc.sh     sage         r     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    103 0.55500 abc.sh     gene         r     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    104 0.55500 abc.sh     sage         r     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    105 0.55500 abc.sh     gene         t     06/29/2018 13:27:48 all.q@limbo1-3                     1        
    106 0.55500 abc.sh     sage         t     06/29/2018 13:27:48 all.q@limbo1-2                     1        
    107 0.55500 abc.sh     gene         qw    06/29/2018 13:27:40                                    1        
    108 0.55500 abc.sh     sage         qw    06/29/2018 13:27:40                                    1        
    109 0.55500 abc.sh     gene         qw    06/29/2018 13:27:41                                    1        
    110 0.55500 abc.sh     sage         qw    06/29/2018 13:27:41                                    1        
    111 0.55500 abc.sh     gene         qw    06/29/2018 13:27:42                                    1        
    112 0.55500 abc.sh     sage         qw    06/29/2018 13:27:42                                    1        
    113 0.55500 abc.sh     gene         qw    06/29/2018 13:27:43                                    1        
    114 0.55500 abc.sh     sage         qw    06/29/2018 13:27:43                                    1        
    115 0.55500 abc.sh     gene         qw    06/29/2018 13:27:44                                    1        
    116 0.55500 abc.sh     sage         qw    06/29/2018 13:27:44                                    1        
    117 0.55500 abc.sh     gene         qw    06/29/2018 13:27:45                                    1        
    118 0.55500 abc.sh     gene         qw    06/29/2018 13:27:46                                    1        
    119 0.55500 abc.sh     gene         qw    06/29/2018 13:27:47                                    1

Remov((ing->e)) Jobs

To remove a job, you can use qdel
Code:
[gene@limbo1-1 root]$ qdel 207
gene has deleted job 207

1. And replace the user "gene" & "sage" by names like "shufang" or others.
Because we do not want user to use "gene" or "sage" to run their jobs. It may mislead them.

2. I am not sure what the relationship between job & task. It sounds a job can contain a set of tasks.
Please check the difference, and correct the "job" & "task" in the doc.

Good to me.

For 1 , ok. I will use shufang and hututa.

For 2, there is no difference, it just my wrong choice of word... Considering some wordings of sge is using jobs, I will use jobs only.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: