-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpls.sh
More file actions
executable file
·102 lines (86 loc) · 4.01 KB
/
Copy pathpls.sh
File metadata and controls
executable file
·102 lines (86 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
current_path="$(dirname "$0")"
source "$current_path/cluster_helpers.sh"
CLUSTER=bluehive3
usage() {
echo "Usage: $0 [-a|--cluster CLUSTER]"
echo "Supported clusters: $(cluster_supported_list)"
}
while [[ $# -gt 0 ]]; do
case "$1" in
-a|--cluster)
if [[ -z "$2" || "$2" == -* ]]; then
echo "Error: $1 requires a cluster name" >&2
exit 1
fi
CLUSTER=$2
shift 2
;;
--cluster=*)
CLUSTER="${1#*=}"
shift
;;
-h|--help)
usage
exit 0
;;
--)
shift
break
;;
*)
echo "Error: Unexpected argument '$1'" >&2
usage >&2
exit 1
;;
esac
done
require_cluster "$CLUSTER" || exit 1
HOSTNAME="$(cluster_hostname "$CLUSTER")" || exit 1
echo "CLUSTER: $CLUSTER"
echo "HOSTNAME: $HOSTNAME"
source "$current_path/start_ssh_control.sh" -a "$CLUSTER"
ssh -o ControlMaster=auto -o ControlPath=/tmp/ssh_$CLUSTER -o StrictHostKeyChecking=no "$USER@$HOSTNAME"<<ENDSSH
echo
echo "=================================== CLUSTER STATUS ==================================="
echo
echo "📊 DOPPELBOCK PARTITION JOBS:"
squeue -O jobarrayid:12,partition:12,username:10,timeused:12,timelimit:12,numcpus:5,gres:12,minmemory:15,nodelist:10,name:40,reason:30 | awk 'NR == 1 || /doppelbock/' | column -t
echo
echo "📊 DMI PARTITION JOBS:"
squeue -O jobarrayid:12,partition:12,username:10,timeused:12,timelimit:12,numcpus:5,gres:12,minmemory:15,nodelist:10,name:40,reason:30 | awk 'NR == 1 || /dmi/' | column -t
echo
echo "👤 YOUR JOBS IN OTHER PARTITIONS:"
squeue -O jobarrayid:12,partition:12,username:10,timeused:12,timelimit:12,numcpus:5,gres:12,minmemory:15,nodelist:10,name:40,reason:30 -u \$USER | awk 'NR > 1 && !/doppelbock/ && !/dmi/' | column -t
echo
echo "================================================================================"
# Get free CPU count
DMI_FREE_CPU=\$(scontrol show node bhc0208 | grep 'CPUAlloc' | awk '{print \$1}' | awk -F'=' '{print 24-\$2}')
DOPPELBOCK_FREE_CPU=\$(scontrol show node bhg0061 | grep 'CPUAlloc' | awk '{print \$1}' | awk -F'=' '{print 64-\$2}')
# Get free GPU count with error handling
DMI_FREE_GPU=\$(squeue -w bhc0208 -O gres:15 | awk 'NR>1' | grep -o 'gpu:[0-9]*' | awk -F':' '{sum += \$2} END {print 1-sum+0}')
DOPPELBOCK_FREE_GPU=\$(squeue -w bhg0061 -O gres:15 | awk 'NR>1' | grep -o 'gpu:[0-9]*' | awk -F':' '{sum += \$2} END {print 4-sum+0}')
# Get memory info for DMI node
DMI_TOTAL_MEMORY=\$(scontrol show node bhc0208 | grep -o 'RealMemory=[0-9]*' | cut -d'=' -f2)
DMI_ALLOC_MEMORY=\$(scontrol show node bhc0208 | grep -o 'AllocMem=[0-9]*' | cut -d'=' -f2)
DMI_TOTAL_MEMORY_GB=\$(((\${DMI_TOTAL_MEMORY:-0}+512)/1024))
DMI_FREE_MEMORY_GB=\$(((\${DMI_TOTAL_MEMORY:-0}-\${DMI_ALLOC_MEMORY:-0}+512)/1024))
# Get memory info for DOPPELBOCK node
DOPPELBOCK_TOTAL_MEMORY=\$(scontrol show node bhg0061 | grep -o 'RealMemory=[0-9]*' | cut -d'=' -f2)
DOPPELBOCK_ALLOC_MEMORY=\$(scontrol show node bhg0061 | grep -o 'AllocMem=[0-9]*' | cut -d'=' -f2)
DOPPELBOCK_TOTAL_MEMORY_GB=\$(((\${DOPPELBOCK_TOTAL_MEMORY:-0}+512)/1024))
DOPPELBOCK_FREE_MEMORY_GB=\$(((\${DOPPELBOCK_TOTAL_MEMORY:-0}-\${DOPPELBOCK_ALLOC_MEMORY:-0}+512)/1024))
echo
echo "🖥️ RESOURCE AVAILABILITY:"
echo
printf "%-15s %-15s %-15s %-20s\n" "PARTITION" "CPU:FREE/TOTAL" "GPU:FREE/TOTAL" "MEMORY:FREE/TOTAL"
printf "%-15s %-15s %-15s %-20s\n" "----------" "---------------" "---------------" "--------------------"
printf "%-15s %-15s %-15s %-20s\n" "DMI" "\${DMI_FREE_CPU}c/24c" "\${DMI_FREE_GPU}g/1g" "\${DMI_FREE_MEMORY_GB}GB/\${DMI_TOTAL_MEMORY_GB}GB"
printf "%-15s %-15s %-15s %-20s\n" "DOPPELBOCK" "\${DOPPELBOCK_FREE_CPU}c/64c" "\${DOPPELBOCK_FREE_GPU}g/4g" "\${DOPPELBOCK_FREE_MEMORY_GB}GB/\${DOPPELBOCK_TOTAL_MEMORY_GB}GB"
echo
echo
echo "💾 DISK QUOTA:"
quota snormanh_lab
echo
echo "================================================================================"
ENDSSH