[torqueusers] getting the Jod ID

Glen Beane glen.beane at gmail.com
Mon Nov 26 09:54:21 MST 2012


On Tue, Nov 20, 2012 at 12:32 AM, mauede at alice.it <mauede at alice.it> wrote:
> I am using a script, from a parallelized Monte Carlo code package, which
> submits a number of  pbs jobs.
> The command is the following:
> $HEN_HOUSE/scripts/run_user_code_batch  BEAM_MS_OF5x5_without-Cu-ReDo
> BEAM_All7CMs_BCSE_Masheed-Tim_lower_Ecutoffs 521icru2 long batch=pbs p=46
> In the above case the script  "run_user_code_batch" submits 46 batch jobs.
> As a consequence 46 job Ids are printed out to stdout (screen).
> I need to automatically capture those job Ids inside the scripts that
> submits them.
> The only way that comes to my mind is to redirect the output of the script
> to a file and then extract the submitted job Ids from the text files.
> There should be a more elegant way to do that.
> Thank you in advance for any suggest ion.
> Kind regards,
> maura

this is really a bash question and not Torque.

you can capture stdout of a qsub command in bash like this:

JOB_ID=$(qsub ...)

you can store all 46 of these job IDs in an array,  check some Bash
documentation for more information


More information about the torqueusers mailing list