Changeset 372


Ignore:
Timestamp:
06/13/07 13:01:58 (17 years ago)
Author:
bastiaans
Message:

jobarchived/jobarchived.py:

  • translate XML uniencoded strings to normal strings always
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/jobarchived/jobarchived.py

    r371 r372  
    584584                if name == 'CLUSTER':
    585585
    586                         self.clustername = attrs.get( 'NAME', "" )
     586                        self.clustername = str( attrs.get( 'NAME', "" ) )
    587587
    588588                elif name == 'METRIC' and self.clustername in ARCHIVE_DATASOURCES:
    589589
    590                         metricname = attrs.get( 'NAME', "" )
     590                        metricname = str( attrs.get( 'NAME', "" ) )
    591591
    592592                        if metricname == 'MONARCH-HEARTBEAT':
    593                                 self.heartbeat = attrs.get( 'VAL', "" )
     593                                self.heartbeat = str( attrs.get( 'VAL', "" ) )
    594594
    595595                        elif metricname.find( 'MONARCH-JOB' ) != -1:
    596596
    597597                                job_id  = metricname.split( 'MONARCH-JOB-' )[1].split( '-' )[0]
    598                                 val     = attrs.get( 'VAL', "" )
     598                                val     = str( attrs.get( 'VAL', "" ) )
    599599
    600600                                if not job_id in self.jobs_processed:
     
    777777                if name == 'GANGLIA_XML':
    778778
    779                         self.XMLSource          = attrs.get( 'SOURCE', "" )
    780                         self.gangliaVersion     = attrs.get( 'VERSION', "" )
     779                        self.XMLSource          = str( attrs.get( 'SOURCE', "" ) )
     780                        self.gangliaVersion     = str( attrs.get( 'VERSION', "" ) )
    781781
    782782                        debug_msg( 10, 'Found XML data: source %s version %s' %( self.XMLSource, self.gangliaVersion ) )
     
    784784                elif name == 'GRID':
    785785
    786                         self.gridName   = attrs.get( 'NAME', "" )
    787                         self.time       = attrs.get( 'LOCALTIME', "" )
     786                        self.gridName   = str( attrs.get( 'NAME', "" ) )
     787                        self.time       = str( attrs.get( 'LOCALTIME', "" ) )
    788788
    789789                        debug_msg( 10, '`-Grid found: %s' %( self.gridName ) )
     
    791791                elif name == 'CLUSTER':
    792792
    793                         self.clusterName        = attrs.get( 'NAME', "" )
    794                         self.time               = attrs.get( 'LOCALTIME', "" )
     793                        self.clusterName        = str( attrs.get( 'NAME', "" ) )
     794                        self.time               = str( attrs.get( 'LOCALTIME', "" ) )
    795795
    796796                        if not self.clusters.has_key( self.clusterName ) and self.clusterName in ARCHIVE_DATASOURCES:
     
    802802                elif name == 'HOST' and self.clusterName in ARCHIVE_DATASOURCES:     
    803803
    804                         self.hostName           = attrs.get( 'NAME', "" )
    805                         self.hostIp             = attrs.get( 'IP', "" )
    806                         self.hostReported       = attrs.get( 'REPORTED', "" )
     804                        self.hostName           = str( attrs.get( 'NAME', "" ) )
     805                        self.hostIp             = str( attrs.get( 'IP', "" ) )
     806                        self.hostReported       = str( attrs.get( 'REPORTED', "" ) )
    807807
    808808                        debug_msg( 10, ' | |-Host found: %s - ip %s reported %s' %( self.hostName, self.hostIp, self.hostReported ) )
     
    810810                elif name == 'METRIC' and self.clusterName in ARCHIVE_DATASOURCES:
    811811
    812                         type = attrs.get( 'TYPE', "" )
     812                        type = str( attrs.get( 'TYPE', "" ) )
    813813                       
    814814                        exclude_metric = False
     
    816816                        for ex_metricstr in ARCHIVE_EXCLUDE_METRICS:
    817817
    818                                 orig_name = attrs.get( 'NAME', "" )     
     818                                orig_name = str( attrs.get( 'NAME', "" ) )
    819819
    820820                                if string.lower( orig_name ) == string.lower( ex_metricstr ):
     
    829829
    830830                                myMetric                = { }
    831                                 myMetric['name']        = attrs.get( 'NAME', "" )
    832                                 myMetric['val']         = attrs.get( 'VAL', "" )
     831                                myMetric['name']        = str( attrs.get( 'NAME', "" ) )
     832                                myMetric['val']         = str( attrs.get( 'VAL', "" ) )
    833833                                myMetric['time']        = self.hostReported
    834834
Note: See TracChangeset for help on using the changeset viewer.