<div>Bill:</div>
<div> </div>
<div>The following perl script seems to do the job.</div>
<div>It essentially works on pbsnodes -a. You may have to modify it slightly since</div>
<div>some statements in this script are customized for the set-up I work on.</div>
<div> </div>
<div>-Madhu</div>
<div> </div>
<div>------------------------------------------------------------------------------------------------------------------------------------------------------</div>
<div>
<p>#!/usr/bin/perl</p>
<p>$nodes_free=0;<br>$single_cpu_node_free=0;</p>
<p>open( PBSNODES, "pbsnodes -a |") || die "Could not run pbsnodes: $!\n";</p>
<p>printf "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";<br>printf " CLUSTER STATUS \n";<br>printf "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";
<br>while(<PBSNODES>) {<br> @A=split;<br> $NF=$#A + 1.;<br> $NN=$A[0];<br> if ( $NN=~/node/ ) {$ndname=$NN;}<br> if ( $NN=~/head/ ) {$ndname=$NN;}<br> if ( /state/ && /free/ )<br> {<br> $nodes_free++;
<br> if( $ndname=~/node/ )<br> { printf " $ndname | free\n";}<br> }<br> if ( /state/ && /job-exclusive/ )<br> { printf " $ndname | NOT free \n";}<br> if ( /jobs/ && $NF==3 ) {
<br> $nodes_free--;<br> $single_cpu_node_free++;<br> printf " WAIT !! $ndname has only 1 cpu free\n";}<br>}</p>
<p>$cpus_free=$nodes_free*2+$single_cpu_node_free;<br>if ( $nodes_free == 0 ) {$nodes_free = "None";}<br>if ( $single_cpu_node_free == 0 ) {$single_cpu_node_free = "None";}<br>if ( $cpus_free == 0 ) {$cpus_free = "None";}
<br>$nodes_free--;<br>$cpus_free--;<br>$cpus_free--;<br>$diff=15-$nodes_free;<br>if ( $diff == 0 ) {$diff = "None";}</p>
<p>printf "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";<br>printf " Number of cpus free excluding the head : $cpus_free \n" ;<br>printf " Number of nodes occupied : $diff\n";
<br>printf " Number of nodes with both cpus free : $nodes_free\n" ;<br>printf " Number of nodes with only one cpu free : $single_cpu_node_free\n";<br>printf "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";
<br><br></p></div>
<div><span class="gmail_quote">On 9/5/06, <b class="gmail_sendername">Garrick Staples</b> <<a href="mailto:garrick@clusterresources.com">garrick@clusterresources.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Tue, Sep 05, 2006 at 04:14:51PM +0200, bill alleged:<br>> Hello<br>><br>> How can I know how many resources have I left?
<br>><br>> By hand, I can make a qstat -f and count how many nodes and ppn are<br>> used, but is there an automatic way to do this?<br>><br>> With an output like:<br>> cluster with 10 nodes, 3 nodes with 4 ppn free, 2 nodes with 2
<br>> CPU free and 2 nodes with 1 CPU free, other nodes full.<br><br>There is nothing in TORQUE that currently does this, but a contribution<br>along those lines would be accepted :)<br><br>_______________________________________________
<br>torqueusers mailing list<br><a href="mailto:torqueusers@supercluster.org">torqueusers@supercluster.org</a><br><a href="http://www.supercluster.org/mailman/listinfo/torqueusers">http://www.supercluster.org/mailman/listinfo/torqueusers
</a><br></blockquote></div><br><br clear="all"><br>-- <br>_________________________________________________<br>Pai, Gurpura Madhusudan<br>Graduate Research Assistant,<br>Computational Fluid Dynamics Center,<br>0095-D Black Engineering,
<br>Iowa State University,<br>Ames, IA-50011<br>ph: (515) 294 6954<br><br><a href="http://www.iastate.edu">http://www.iastate.edu</a><br><a href="http://www.me.iastate.edu/CFDC/">http://www.me.iastate.edu/CFDC/</a><br><a href="http://www.public.iastate.edu/~mpai/">
http://www.public.iastate.edu/~mpai/</a>