Skip to content

Instantly share code, notes, and snippets.

@icaoberg
Created May 12, 2014 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icaoberg/0cd48f9483b5644f7974 to your computer and use it in GitHub Desktop.
Save icaoberg/0cd48f9483b5644f7974 to your computer and use it in GitHub Desktop.
[PBS] List nodes by queue name #cluster
#!/bin/bash
#TODO make it faster
if [ $# -eq 0 ]
then
for NODE in `pbsnodes | grep -R "compute" | cut -d"=" -f1 | grep -R "compute"`
do
QUEUE=`pbsnodes $NODE | grep "properties" | cut -d"=" -f2`
echo $NODE $QUEUE
done
elif [ $# -eq 1 ]
then
QUERY_QUEUE_NAME=`echo $1 | tr -d ' '`
for NODE in `pbsnodes | grep -R "compute" | cut -d"=" -f1 | grep -R "compute"`
do
QUEUE=`pbsnodes $NODE | grep "properties" | cut -d"=" -f2 | tr -d ' '`
if [ "$QUEUE" == "$QUERY_QUEUE_NAME" ]
then
echo $NODE
fi
done
else
echo "Usage"
echo "list_nodes_by_queue.sh"
echo "list_nodes_by_queue.sh <queue_name>"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment