[gram-user] SGE WS-GRAM integration - it works on CentOS 5.3 64bit after a simple trick

Fabio.Martinelli at esa.int Fabio.Martinelli at esa.int
Wed Oct 28 09:40:22 CDT 2009


also this file was not there, but it's important for the MDS/SGE 6.2 
relation, create that , chown it to globus.globus, chmod ugo+rx

for SGE 6.1 erase the string " $reserved_cpu_per_ind_queue," I introduced 
to manage the 6.2 qstat output format


[root at scigrid libexec]# cat 
$GLOBUS_LOCATION/libexec/globus-scheduler-provider-sge
#!/usr/bin/env perl 



$ENV{'SGE_ROOT'} = '/opt/sge';
# Scheduler commands used in the program
my $queue_cmd = '/opt/sge/bin/lx24-amd64/qstat -f';
my $list_queues = '/opt/sge/bin/lx24-amd64/qconf -sql';


#------------------------------------------------------
# from the $list_queues command:
#
my @queues = `$list_queues`;
chomp @queues;

my $free=0; $used=0; $total=0, $cpus=0; $reserved=0;
my $need_to_end_a_previous_queue=0;

print "<scheduler xmlns=\"http://mds.globus.org/batchproviders/2004/09\" 
>\n";

foreach (@queues) {

   $queue_name = $_;
   #------------------------------------------------------
   # for each queue get total and free cpus
   #
   open(FP, "$queue_cmd -q $_ |");

   $free=0; $used=0; $total=0, $cpus=0; $enabled = 0; 

   while ( <FP> )
   {
      my ($queuename, $qtype, $cpu, $load_avg, $arch, $states) = 
split('\s+', $_) if /^$queue_name.*/;
      chomp $states;

      next if ( $queuename =~ /^queuename$/ ) | ( $queuename =~ 
/^-------.*/ ) ;

# analyse the state of queue: 
      $enabled = $enabled + 1 if ! ( $states =~ /.*(d|E).*/ );
# if $states is "d" or "E" then the queue is disabled or in error state 
respectively and should not be counted !
      next if ( $states =~ /.*(d|E).*/ ); 

# analyse whether the host is available or not:
# host is not present in the cluster if $load_avg or $arch is equal -NA-
      next if ( $load_avg =~ /^-NA-$/) | ( $arch =~ /^-NA-$/);

# count total and used CPUs:
      ( $reserved_cpu_per_ind_queue, $used_cpu_per_ind_queue, 
$total_cpu_per_ind_queue ) = split('/',$cpu);

      $free = $free + $total_cpu_per_ind_queue - $used_cpu_per_ind_queue;
      $total = $total + $total_cpu_per_ind_queue;
      $used = $used + $used_cpu_per_ind_queue;
 
   }

   close FP;

#------------------------------------------------------
# get queue names and queue characteristics
# 
   $need_to_end_a_previous_queue=0;

   if ($need_to_end_a_previous_queue)
   {
      print "   </Queue>\n";
   }

   $need_to_end_a_previous_queue=1;

   print "   <Queue name=\"$queue_name\">\n";
   print "      <totalnodes>$total</totalnodes>\n";
   print "      <freenodes>$free</freenodes>\n";
   print "      <maxCount>$total</maxCount>\n";

# the following values are currently hard coded.  Make enhancements to
# get these values dynamically if possible.
   print "      <maxtime>unknown</maxtime>\n";
   print "      <maxCPUtime>unknown</maxCPUtime>\n";
   print "      <maxReqNodes>unknown</maxReqNodes>\n";
   print "      <maxRunningJobs>unknown</maxRunningJobs>\n";
   print "      <maxJobsInQueue>unknown</maxJobsInQueue>\n";
   print "      <maxTotalMemory>unknown</maxTotalMemory>\n";
   print "      <maxSingleMemory>unknown</maxSingleMemory>\n";
   print "      <whenActive>unknown</whenActive>\n";

# get dynamic queue information below
   print "      <dispatchType>batch</dispatchType>\n" if ( $qtype =~ 
/.*(B|P).*/ );

   print "      <status>enabled</status>\n" if ( $enabled > 0 ); 
   print "      <status>disabled</status>\n" if ( $enabled == 0 );

   print "      <numJobs>$used</numJobs>\n";

   if ($need_to_end_a_previous_queue)
   {
       print "   </Queue>\n";
   }

}
print "</scheduler>\n";

exit 0;
[root at scigrid libexec]#


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 8596 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.globus.org/pipermail/gram-user/attachments/20091028/5aa917ab/attachment.bin>


More information about the gram-user mailing list