Simplification of the command to get queue state
With a fake_user, sge command doesn't return any pending jobs.
This commit is contained in:
parent
19a233d145
commit
f2149ced87
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue