How to get job id from qsub

I am using a cluster. I will use the qsub command to distribute my work, I want me to be able to return the job id so that I can control the work.

Basically, I want something like this:

#!/bin/bash
JOBID=$( qsub job1 )
# Monitoring base on $JOBID

I found the page http://wiki.ibest.uidaho.edu/index.php/Tutorial:_Submitting_a_job_using_qsub and it talks about the variable PBS_JOBID, but I don’t know how to use it. Does anyone know how to do this?

(My decision now jobID='qsub task | cut -d ' ' -f 3')

+4
source share
2 answers

qsub . ( Grid) qsub, jobid.

BLAHP ( ).

jobID=`${pbs_binpath}/qsub $bls_tmp_file` # actual submission
...

# The job id is actually the first numbers in the string (slurm support)
jobID=`echo $jobID | awk 'match($0,/[0-9]+/){print substr($0, RSTART, RLENGTH)}'`

()

qsub PBS, PBS Pro, SLURM.

+5

-terse:

$ echo sleep 5 | qsub -terse
3543
+3

Source: https://habr.com/ru/post/1535241/


All Articles