Repository navigation
Expand file tree
/
Copy pathcluster_helpers.sh
More file actions
86 lines (78 loc) · 1.87 KB
/
Copy pathcluster_helpers.sh
File metadata and controls
86 lines (78 loc) · 1.87 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
#!/usr/bin/env bash
cluster_supported() {
case "$1" in
bluehive|bluehive3|bhward)
return 0
;;
*)
return 1
;;
esac
}
cluster_supported_list() {
printf "bluehive, bluehive3, bhward"
}
cluster_hostname() {
case "$1" in
bluehive)
printf "bluehive.circ.rochester.edu"
;;
bluehive3)
printf "bluehive3.circ.rochester.edu"
;;
bhward)
printf "bhward.circ.rochester.edu"
;;
*)
echo "Error: Unknown cluster '$1'. Supported clusters: $(cluster_supported_list)" >&2
return 1
;;
esac
}
cluster_compute_host() {
case "$1" in
bluehive)
printf "bluehive_compute"
;;
bluehive3)
printf "bluehive_compute3"
;;
bhward)
printf "bhward_compute"
;;
*)
echo "Error: Unknown cluster '$1'. Supported clusters: $(cluster_supported_list)" >&2
return 1
;;
esac
}
cluster_shortcut() {
case "$1" in
bluehive)
printf "blhc"
;;
bluehive3)
printf "blhc3"
;;
bhward)
printf "bhwc"
;;
*)
echo "Error: Unknown cluster '$1'. Supported clusters: $(cluster_supported_list)" >&2
return 1
;;
esac
}
cluster_control_path() {
local cluster_name="$1"
local local_user_id
require_cluster "$cluster_name" || return 1
local_user_id="$(id -u)" || return 1
printf '/tmp/unix-scripts-login-%s-%s.sock' "$local_user_id" "$cluster_name"
}
require_cluster() {
if ! cluster_supported "$1"; then
echo "Error: Unknown cluster '$1'. Supported clusters: $(cluster_supported_list)" >&2
return 1
fi
}