From f2149ced87510e17978cb12a8e574a700ee122d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 5 Jun 2020 07:32:03 +0200 Subject: [PATCH] Simplification of the command to get queue state With a fake_user, sge command doesn't return any pending jobs. --- cluster/disable.host.queue.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cluster/disable.host.queue.sh b/cluster/disable.host.queue.sh index 06a7298..73cca1e 100755 --- a/cluster/disable.host.queue.sh +++ b/cluster/disable.host.queue.sh @@ -66,10 +66,10 @@ is_queue_enable() { # {{{ local_sge_hostname="${1}" local_sge_queue_name="${2}" ## List all queues with 'disable' state and filter to the expected queue name - ### Then count the number of lines between "queuename" (from header) and the expected queue - ### To avoid to count pending jobs for this queue - local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" \ - | awk 'BEGIN {count = 0} /queuename/,/main.q/ {count++} END { print count }') + ## with a fake_user to avoid pending jobs for this queue + ### And count returned lines + local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" -u fake_user \ + | wc -l) case "${local_sge_queue_test}" in 0 ) ## No result so the queue is enable @@ -100,10 +100,10 @@ is_queue_disable() { # {{{ local_sge_hostname="${1}" local_sge_queue_name="${2}" ## List all queues with 'disable' state and filter to the expected queue name - ### Then count the number of lines between "queuename" (from header) and the expected queue - ### To avoid to count pending jobs for this queue - local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" \ - | awk 'BEGIN {count = 0} /queuename/,/main.q/ {count++} END { print count }') + ## with a fake_user to avoid pending jobs for this queue + ### And count returned lines + local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" -u fake_user \ + | wc -l) case "${local_sge_queue_test}" in 0 ) ## No result so the queue is enable