File tree Expand file tree Collapse file tree
dot_local/share/zinit/plugins/hpc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,43 @@ if [[ -z "${SCRATCH}" ]] && [[ -d "{{ .scratch_root }}" ]]; then
2323 export SCRATCH=" {{ .scratch_root }}"
2424fi
2525
26+ function _select-compute-node() {
27+ if [[ ! -x " $( command -v squeue) " ]]; then
28+ echo " squeue not found." >&2
29+ return 1
30+ fi
31+
32+ if [[ ! -x " $( command -v fzf) " ]]; then
33+ echo " fzf not found." >&2
34+ return 1
35+ fi
36+
37+ local node=$( squeue -u ${USER} -o " %N %j %M" -h 2> /dev/null | fzf | awk ' {print $1}' )
38+
39+ if [ -z " ${node} " ]; then
40+ echo " No node selected, exiting." >&2
41+ return 1
42+ fi
43+
44+ echo " ${node} "
45+ }
46+
47+ function compute-ssh() {
48+ local node=$( _select-compute-node) || return 1
49+
50+ echo " Connecting to ${node} ..."
51+ ssh -t -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${node}
52+ }
53+
54+ function compute-docker() {
55+ local node=$( _select-compute-node) || return 1
56+
57+ echo " Connecting to ${node} and attaching to Docker container..."
58+ ssh -t -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${node} \
59+ ' docker exec -it `docker ps -q | head -1` /bin/zsh -l'
60+ }
61+
62+
2663{{- if .nrel_hpc }}
2764# Custom for NREL HPC machines
2865
You can’t perform that action at this time.
0 commit comments