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