-1

I would like to submit a job array with a list of non-sequential numbers for the SGE_TASK_ID and I also get an error that says, "The initial portion of the string 'file.sh' doesn't contain decimal numbers". Any suggestions?

I have a file containing the values that I would like to use as the SGE_TASK_IDs. I will call this file "tasknumbers" (exactly how it appears in the file).

3 
5 
10 
25 
50 
100 

I have a shell script to retrieve the values to input as the SGE_TASK_IDs

#!/bin/sh
#taskid.sh
taskid=~/folder/tasknumbers
id=$(awk "NR==SGE_TASK_ID" $taskid)

I have an additional file where the SGE_TASK_ID will be used as an input parameter that I will call file.sh (This is a wrapper that takes the task ID and inputs the value in a test).

In the terminal I typed (which returns an error):

qsub -cwd -N output -t $id ./file.sh -pe

The error:

qsub: Numerical value invalid!
The initial portion of string "./file.sh" contains no decimal number
Barb
  • 9
  • 2
  • use 4 spaces at the front of each line that you want to show as code, or highlight a block and then select the format tool (`{}`) at the top left of the edit box. Good luck. – shellter Dec 02 '14 at 03:01
  • (1) What is `SGE_TASK_ID` in the `awk` code? (2) what is the value of the `id` variable? -- I guess the `id` variable is empty and then the command typed really is `qsub -cwd -N output -t ./file.sh -pe`. As `./file.sh` is not a decimal value, the error message is reported. – Jdamian Dec 03 '14 at 10:37
  • The shell script above was part of an example. Awk is supposed to grab the numbers for SGE_TASK_ID from the file tasknumbers (which I later assigned the name taskid within the script). $id is the array of numbers i.e., 3, 5, 10, 25, 50, 100. – Barb Dec 03 '14 at 16:25
  • (1) Please, post your `tasknumbers` file as it is. (2) Post the output of the following command `echo qsub -cwd -N output -t $id ./file.sh -pe` – Jdamian Dec 03 '14 at 19:52
  • The output from echo is the exact same as the qsub command i.e., qsub -cwd -N output -t $id ./file.sh -pe – Barb Dec 04 '14 at 20:37
  • Please, now post the output of the command `awk "NR==SGE_TASK_ID" ~/folder/tasknumbers` – Jdamian Dec 05 '14 at 08:21
  • Where does that `"./testwrapper.sh"` come from? – Jdamian Dec 05 '14 at 08:22
  • I changed a few of the names to use in this example. It's supposed to be file.sh. If I type in the line you suggested, nothing is returned. – Barb Dec 07 '14 at 14:57
  • Nothing as I suspected. Therefore, the value of `id` variable is empty and the qsub command executed is `qsub -cwd -N output -t ./file.sh -pe`. What is the purpose of `awk "NR==SGE_TASK_ID" ~/folder/tasknumbers`? – Jdamian Dec 08 '14 at 17:19
  • I wanted to pass a list of numbers through the qsub command instead of using the regular expression for an array e.g., 1-10:2 since my list of numbers doesn't follow a sequence. I thought that awk "NR==SGE_TASK_ID" ~/folder/tasknumbers would retrieve the numbers from the file. – Barb Dec 09 '14 at 00:32
  • Maybe I am not getting this, but $id needs to be set prior to executing qsub. From what I gather, qsub us calling a script (which maybe calls awk?) which sets $id. If this is the case, then $id is not set and therefore qsub will report this error. – Vince Dec 17 '14 at 15:58

1 Answers1

1

Maybe something like this will work:

tasknumbers file:

1
3 
5 
10 
25 
50 
100 

Use for loop to submit one job per task id:

for id in `cat tasknumbers`
do
    qsub -cwd -N output -t $id ./file.sh -pe
done
Vince
  • 3,325
  • 2
  • 23
  • 41