PBS Command : I'm using the following command " qstat -an -1 -w ``'qselect -q quename -l resourcelist' , If it doesnt find any valid job, it is printing all jobs in the q. Any work around available?

Arav
Arav Altair Community Member
edited October 2021 in Community Q&A

 I'm using the following command " qstat -an -1 -w ``'qselect -q quename -l resourcelist'  , If it doesnt find any valid job, it is printing all jobs in the q.  Any work around available to print "none" when it doesnt find any jobs that satisfy my filter?

Best Answer

  • Joseph Miller III_21250
    Joseph Miller III_21250 New Altair Community Member
    edited October 2021 Answer ✓

    qselect acts much like an SQL select statement; you can simply call it to check what is output before putting through another command like qstat or qdel. Unfortunately, if it returns nothing, you get no parameters passed to qstat command to limit the search.

    Probably the quick and dirty way of accomplishing what you need is to run it through a bash "if not empty" operation. Something like:

    [ ! -z `qselect -q workq -l ncpus.gt.2`] && qstat -n1w `qselect -q workq -l ncpus.gt.2`

    This isn't the cleanest method, but gets the job done.

Answers

  • Joseph Miller III_21250
    Joseph Miller III_21250 New Altair Community Member
    edited October 2021 Answer ✓

    qselect acts much like an SQL select statement; you can simply call it to check what is output before putting through another command like qstat or qdel. Unfortunately, if it returns nothing, you get no parameters passed to qstat command to limit the search.

    Probably the quick and dirty way of accomplishing what you need is to run it through a bash "if not empty" operation. Something like:

    [ ! -z `qselect -q workq -l ncpus.gt.2`] && qstat -n1w `qselect -q workq -l ncpus.gt.2`

    This isn't the cleanest method, but gets the job done.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.