From 04515dcd3541a5048cdc5927ec34e3c94e029ca1 Mon Sep 17 00:00:00 2001 From: Wirawan Purwanto Date: Fri, 9 Sep 2016 16:41:15 -0400 Subject: [PATCH] * Allow external qstat-f file for raw node status dump. --- sge/node-slot-status.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sge/node-slot-status.sh b/sge/node-slot-status.sh index 71a96c3..d8d86b1 100755 --- a/sge/node-slot-status.sh +++ b/sge/node-slot-status.sh @@ -11,12 +11,22 @@ function node_slot_stats_raw() +{ + qstat -f | _Process_node_slot_stats_raw +} + +function node_slot_stats_raw_f() +{ + _Process_node_slot_stats_raw "$1" +} + + +function _Process_node_slot_stats_raw() # Prints the node stats from `qstat -f' in raw format: # - not printing disabled nodes # - not showing the computational jobs that are running on these nodes { - qstat -f \ - | gawk -v optShowDisabledNodes="$optShowDisabledNodes" \ + gawk -v optShowDisabledNodes="$optShowDisabledNodes" \ ' BEGIN { STDERR = "/dev/stderr" @@ -27,7 +37,7 @@ FNR == 1 && $1 == "queuename" { print; next; } ($0 ~ /^[A-Za-z]/) && (NF == 5 || NF == 6) && (optShowDisabledNodes!=0 || ($6 !~ /d/)) { print } -' +' "$@" } @@ -148,7 +158,11 @@ function node_slot_stats_per_machine_type_f() case "$1" in (--raw|raw) - node_slot_stats_raw + if [ "$2" ]; then + node_slot_stats_raw_f "$2" + else + node_slot_stats_raw + fi ;; (--stats|stats|"") if [ "$2" ]; then