0

how to qsub job iteratively?

Let a variable i=2:10, for each i, I would like to run "tmp.r" and to pause 10 seconds before going to the next i. And my script name is test.pbs. I tried this:

for i in `seq 1 10`;do;qsub job$i.sub;sleep 10;done

but this submitted job will return immediately ..

I would like to run this on Cray XE6. My R code uses a traversal algorithm, so iterative submission of jobs will make it more efficient.

Any idea how to do this with bash or python?

Thanks!

spuder
  • 17,437
  • 19
  • 87
  • 153
user2458189
  • 93
  • 16

2 Answers2

0

By nature, qsub returns a job id immediately so you won't be able to submit jobs in batch like you are describing.

If you are using torque, you could use job arrays. See this documentation

http://docs.adaptivecomputing.com/torque/help.htm#topics/commands/qsub.htm#-t

echo sleep 300 | qsub -t 10


[adaptive@mongo-test3 ~]$ qstat
Job id                    Name             User            Time Use S Queue
------------------------- ---------------- --------------- -------- - -----
19188[].mongo-test3        STDIN            adaptive               0 R batch

If you are using a scheduler such as Moab

[adaptive@mongo-test3 ~]$ showq

active jobs------------------------
JOBID              USERNAME      STATE PROCS   REMAINING            STARTTIME

19188[10]          adaptive    Running     1    00:59:19  Tue Jul 23 16:40:25

1 active job                1 of 8 processors in use by local jobs (12.50%)
                            1 of 1 nodes active      (100.00%)

eligible jobs----------------------
JOBID              USERNAME      STATE PROCS     WCLIMIT            QUEUETIME


0 eligible jobs

blocked jobs-----------------------
JOBID              USERNAME      STATE PROCS     WCLIMIT            QUEUETIME


0 blocked jobs

Total job:  1
spuder
  • 17,437
  • 19
  • 87
  • 153
0

I'm not sure why you couldn't just qsub a single script that will then perform the jobs sequentially once running.

But if it helps, you could submit the jobs and give them the condition to execute only when another job (the previous job, in this case) is completed:

Torque nested/successive qsub call

Community
  • 1
  • 1
gzS
  • 131
  • 4