Ignore:
Timestamp:
02/06/08 09:23:34 (16 years ago)
Author:
bastiaans
Message:

libtoga.php:

  • try to detect if Ganglia or PBS uses FQDN's and whether Job Monarch should too
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/libtoga.php

    r454 r459  
    605605
    606606        function TorqueXMLHandler( $clustername ) {
    607                 $jobs = array();
    608                 $clusters = array();
    609                 $this->nodes = array();
    610                 $heartbeat = array();
    611                 $this->clustername = $clustername;
    612                 //printf(" cluster set to %s \n", $this->clustername );
     607                $jobs                   = array();
     608                $clusters               = array();
     609                $this->nodes            = array();
     610                $heartbeat              = array();
     611                $this->clustername      = $clustername;
     612                $this->fqdn             = 1;
    613613        }
    614614
     
    668668
    669669                        $hostname = $attrs[NAME];
     670
     671
    670672                        $location = $attrs[LOCATION];
    671673                        //printf( "Found node %s\n", $hostname );
     
    685687                                sscanf( $attrs[NAME], 'MONARCH-JOB-%d-%d', $jobid, $monincr );
    686688
    687                                 //printf( "jobid %s\n", $jobid );
    688 
    689689                                if( !isset( $jobs[$jobid] ) )
    690690                                        $jobs[$jobid] = array();
     
    697697                                        $toganame = $togavalues[0];
    698698                                        $togavalue = $togavalues[1];
    699 
    700                                         //printf( "\t%s\t= %s\n", $toganame, $togavalue );
    701699
    702700                                        if( $toganame == 'nodes' ) {
     
    735733                                        if( $jobs[$jobid][status] == 'R' ) {
    736734
     735                                                // Let's see if Ganglia use's FQDN or short hostnames
     736                                                //
     737                                                foreach( $nodes as $hostname => $nimage ) {
     738                                       
     739                                                        if( substr( $hostname, $domain_len ) != $domain )
     740                                                        {
     741                                                                $this->fqdn     = 0;
     742                                                        }
     743                                                }
     744
    737745                                                foreach( $jobs[$jobid][nodes] as $node ) {
    738746
     
    740748                                                        $domain_len = 0 - strlen( $domain );
    741749
    742                                                         if( substr( $node, $domain_len ) != $domain ) {
    743                                                                 $host = $node. '.'.$domain;
    744                                                         } else {
    745                                                                 $host = $node;
     750                                                        if( $this->fqdn )
     751                                                        {
     752                                                                if( substr( $node, $domain_len ) != $domain ) {
     753                                                                        $host = $node. '.'.$domain;
     754                                                                } else {
     755                                                                        $host = $node;
     756                                                                }
     757                                                        }
     758                                                        else
     759                                                        {
     760                                                                $host   = $node;
    746761                                                        }
    747762
Note: See TracChangeset for help on using the changeset viewer.