Created
July 30, 2024 00:58
-
-
Save ImBIOS/c49fe4c65bcc9be438887a3feb6e9013 to your computer and use it in GitHub Desktop.
Find Best PBS Node for VSCode Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to assign a rank to a node based on its properties | |
get_node_rank() { | |
local properties="$1" | |
case "$properties" in | |
*xeon,spr,plat8480,ram512gb,netgbe,dual_gpu,hbm2e,gpu,max,max_1100*) echo 1 ;; | |
*xeon,spr,max9480,ram256gb,netgbe,batch,hbm*) echo 2 ;; | |
*xeon,icx,plat8380,ram2tb,net1gbe,batch*) echo 3 ;; | |
*xeon,icx,gold6348,ramgb,netgbe,jupyter,batch*) echo 4 ;; | |
*xeon,skl,ram384gb,net1gbe,renderkit*) echo 5 ;; | |
*xeon,spr,ram1024gb,netgbe,dnp50*) echo 6 ;; | |
*xeon,skl,gold6128,ram192gb,net1gbe,jupyter,batch,fpga_compile*) echo 7 ;; | |
*xeon,skl,gold6128,ram192gb,net1gbe,jupyter,batch*) echo 8 ;; | |
*xeon,skl,gold6128,ram192gb,net1gbe,fpga_runtime,fpga,agilex*) echo 9 ;; | |
*xeon,skl,gold6128,ram192gb,net1gbe,fpga_runtime,fpga,arria10*) echo 10 ;; | |
*xeon,emr,ram192gb,net1gbe,cpu_runtime*) echo 11 ;; | |
*xeon,clx,ram192gb,net1gbe,batch,extended,fpga,stratix10,fpga_runtime*) echo 12 ;; | |
*xeon,cfl,e-2176g,ram64gb,net1gbe,gpu,gen9*) echo 13 ;; | |
*core,tgl,i9-11900kb,ram32gb,netgbe,gpu,gen11*) echo 14 ;; | |
*) echo 99 ;; # Default rank if no match | |
esac | |
} | |
best_node="" | |
best_rank=99 | |
for node in $(pbsnodes -l free | awk '{print $1}'); do | |
properties=$(pbsnodes "$node" | awk '/properties =/ {print $3}') | |
rank=$(get_node_rank "$properties") | |
if (( rank < best_rank )); then | |
best_rank=$rank | |
best_node=$node | |
fi | |
done | |
if [[ -n "$best_node" ]]; then | |
echo "Best node for VSCode Server: $best_node" | |
pbsnodes "$best_node" | awk '/state = free/ {state=$0} /properties =/ {prop=$0} END {print " " state; print " " prop}' | |
else | |
echo "No suitable nodes found." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PBS Node Selector for VSCode Server
This script helps you find the most suitable node in your PBS cluster for running a VSCode Server instance, especially when working on large TypeScript codebases.
Usage:
find_best_vscode_node.sh
).chmod +x find_best_vscode_node.sh
../find_best_vscode_node.sh
.How it Works:
pbsnodes
.properties
string, which contains hardware information.Customization:
You can adjust the ranking system within the script to match your specific hardware preferences and cluster configuration.
Requirements:
pbsnodes
command accessible in your shellThis script streamlines the process of finding the optimal node for your VSCode Server, allowing you to focus on coding without manual node selection.