Qsub + job array + while read; do; done

Linux Server

Hi!

just some help...

I'm using a "Sun Grid Engine" with "qsub"

In one hand I have this code

while read -r H; do echo ${H}; done < list

The number of the lines in the list file is 100.

On the other hand I want to create a job array with the option -t

echo "echo $H" | qsub -N loop -t 1-100

How can I merge the two codes? In the way to create a job array (1-100) where each job read a line from the list file...?

Many thanks

It's not entirely clear what you are after here. Can you show us a worked example if list file contained 3 lines like this

harry
bob
mary

For example you may want -t value incremented for each line something like this:

   echo "harry" | qsub -N loop -t 1
   echo "bob"   | qsub -N loop -t 2 
   echo "mary"  | qsub -N loop -t 3

Hi,

with your code are 3 different jobs and not three jobs in one array

job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
372502  1.00000 loop       manolis      r     03/09/2018 11:19:58 all.q@localhost                1     1
372503  1.00000 loop       manolis      r     03/09/2018 11:19:58 all.q@localhost                1     2
372504  1.00000 loop       manolis      r     03/09/2018 11:19:58 all.q@localhost                1     3

I tried with 20 jobs

job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID
 372527 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     1
 372528 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     2
 372529 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     3
 372530 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     3
 372531 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     4
 372532 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     5
 372533 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     6
 372534 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     7
 372535 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     8
 372536 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     9
 372537 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     10
 372538 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     11
 372539 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     12
 372540 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     13
 372541 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     14
 372542 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     15
 372543 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     16
 372544 0.00000 loop       manolis      qw    03/09/2018 11:26:01                                1     17
 372545 0.00000 loop       manolis      qw    03/09/2018 11:26:02                                1     19
 372546 0.00000 loop       manolis      qw    03/09/2018 11:26:02                                1     20
  

What I need is something like this:

 372546 0.00000 loop       manolis      qw    03/09/2018 11:26:02                                1     1-20

where the script "loop" read the 20 line (names in this case) from a file (each line would be a job of an array job)

How about:

qsub -N loop -t 1-100 < list