Avoid to count pending jobs in queue state command
This commit is contained in:
parent
01dac009a0
commit
a2df1e2c4e
|
@ -65,9 +65,11 @@ is_queue_enable() { # {{{
|
||||||
|
|
||||||
local_sge_hostname="${1}"
|
local_sge_hostname="${1}"
|
||||||
local_sge_queue_name="${2}"
|
local_sge_queue_name="${2}"
|
||||||
## List all available queues and filter according to both 'disable' state and the expected queue name
|
## 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}" \
|
local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" \
|
||||||
| wc -l)
|
| awk 'BEGIN {count = 0} /queuename/,/main.q/ {count++} END { print count }')
|
||||||
|
|
||||||
case "${local_sge_queue_test}" in
|
case "${local_sge_queue_test}" in
|
||||||
0 ) ## No result so the queue is enable
|
0 ) ## No result so the queue is enable
|
||||||
|
@ -79,7 +81,7 @@ is_queue_enable() { # {{{
|
||||||
return_queue_enable="1"
|
return_queue_enable="1"
|
||||||
;;
|
;;
|
||||||
* ) ## Unexpected result
|
* ) ## Unexpected result
|
||||||
printf '%b\n' "${RED}Not able to determine the state of ${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null} queue.${RESET}"
|
printf '%b\n' "${RED}Not able to determine the state of ${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null} queue (command return ${local_sge_queue_test} lines).${RESET}"
|
||||||
exit 2
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -97,9 +99,11 @@ is_queue_disable() { # {{{
|
||||||
|
|
||||||
local_sge_hostname="${1}"
|
local_sge_hostname="${1}"
|
||||||
local_sge_queue_name="${2}"
|
local_sge_queue_name="${2}"
|
||||||
## List all available queues and filter according to both 'disable' state and the expected queue name
|
## 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}" \
|
local_sge_queue_test=$(qstat -f -qs d -q "${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null}" \
|
||||||
| wc -l)
|
| awk 'BEGIN {count = 0} /queuename/,/main.q/ {count++} END { print count }')
|
||||||
|
|
||||||
case "${local_sge_queue_test}" in
|
case "${local_sge_queue_test}" in
|
||||||
0 ) ## No result so the queue is enable
|
0 ) ## No result so the queue is enable
|
||||||
|
@ -111,7 +115,7 @@ is_queue_disable() { # {{{
|
||||||
return_queue_disable="0"
|
return_queue_disable="0"
|
||||||
;;
|
;;
|
||||||
* ) ## Unexpected result
|
* ) ## Unexpected result
|
||||||
printf '%b\n' "${RED}Not able to determine the state of ${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null} queue.${RESET}"
|
printf '%b\n' "${RED}Not able to determine the state of ${local_sge_queue_name:=/dev/null}@${local_sge_hostname:=/dev/null} queue (command return ${local_sge_queue_test} lines).${RESET}"
|
||||||
exit 3
|
exit 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue