Check slots_used on all SGE queues

This commit is contained in:
Jeremy Gardais 2020-06-18 12:23:17 +02:00
parent 35b9846c80
commit 04b4befbc6
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 7 additions and 3 deletions

View File

@ -138,16 +138,20 @@ is_job_running() { # {{{
local_sge_hostname="${1}"
## List SGE informations about the host
### And get the number of used slots
### And get the number of used slots from all queues
### Sort the results
### Only get the last result (greater number of used slots)
local_sge_slots_used=$(qhost -h "${local_sge_hostname:=/dev/null}" -q -xml \
| grep slots_used \
| sed 's;.*<queuevalue.*>\(.*\)</queuevalue>;\1;')
| sed 's;.*<queuevalue.*>\(.*\)</queuevalue>;\1;' \
| sort --numeric-sort \
| tail --lines=1)
case "${local_sge_slots_used}" in
0 ) ## No jobs are running
return_job_running="1"
;;
* ) ## Results (header + queue name) so the queue is disable
* ) ## Some jobs are running
return_job_running="0"
;;
esac