Disable SGE queue if used slots is EMPTY

This commit is contained in:
Jeremy Gardais 2020-09-25 11:36:12 +02:00
parent d9beee6e27
commit d79c9fe833
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 33 additions and 0 deletions

View File

@ -150,6 +150,28 @@ Used slots did not reach ${local_percentage}% of total slots: ${RED}${local_sge_
return "${return_sge_slots_percentage}"
}
# }}}
is_sge_slots_empty() { # {{{
## Get the number of SGE used slots
local_sge_slots_used=$(qhost -h "${sge_hostname:=/dev/null}" -q -xml \
| grep --max-count=1 -- "'slots_used'" \
| sed 's;.*<queuevalue.*>\(.*\)</queuevalue>;\1;')
if [ "${local_sge_slots_used}" -eq "0" ]; then
## Used slots is null
return_sge_slots_empty="0"
else
return_sge_slots_empty="1"
fi
## Simple debug message to valid current variable
debug_message "is_sge_slots_empty \
SGE slots currently in use: ${RED}${local_sge_slots_used:=/dev/null}${COLOR_DEBUG}."
return "${return_sge_slots_empty}"
}
# }}}
is_pending_job_empty() { # {{{
@ -202,6 +224,17 @@ main() { # {{{
&& exit 0
## }}}
## If SGE used slots is NULL AND {{{
## APT package upgrade is available
### Create a temp file
### Disable SGE queue
is_sge_slots_empty \
&& is_apt_upgrade_present \
&& touch "${APT_TMP_FILE}" && echo "APT upgrade is available." >> "${APT_TMP_FILE}" \
&& sh "${sge_disable_host_queue_script}" \
&& exit 0
## }}}
## If pending job list is empty AND {{{
## APT package upgrade is available
### Create a temp file