From 04b4befbc60ccebcfd33821d5bbcc4e1b3acb9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 18 Jun 2020 12:23:17 +0200 Subject: [PATCH] Check slots_used on all SGE queues --- cluster/apt.apply.update.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cluster/apt.apply.update.sh b/cluster/apt.apply.update.sh index aeaaaff..55b374b 100755 --- a/cluster/apt.apply.update.sh +++ b/cluster/apt.apply.update.sh @@ -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;.*\(.*\);\1;') + | sed 's;.*\(.*\);\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