Changeset 67 for trunk/plugin


Ignore:
Timestamp:
04/14/05 12:53:04 (19 years ago)
Author:
bastiaans
Message:

plugin/togap.py:

  • Added domain name parsing
  • Added nodelist parsing
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugin/togap.py

    r66 r67  
    2020import time
    2121import os
     22import socket
    2223import string
    2324
     
    133134
    134135                for name, attrs in joblist.items():
     136
     137                        print attrs
    135138
    136139                        job_id = name.split( '.' )[0]
     
    150153                        status = self.getAttr( attrs, 'job_state' )
    151154                        start_timestamp = self.getAttr( attrs, 'mtime' )
    152                         #stop_timestamp = ''
     155
     156                        nodes = self.getAttr( attrs, 'exec_host' ).split( '+' )
     157                        nodeslist = [ ]
     158
     159                        for node in nodes:
     160                                host = node.split( '/' )[0]
     161
     162                                if nodeslist.count( host ) == 0:
     163                                        nodeslist.append( node.split( '/' )[0] )
    153164
    154165                        myAttrs = { }
     
    161172                        myAttrs['status'] = status
    162173                        myAttrs['start_timestamp'] = start_timestamp
    163                         #myAttrs['stop_timestamp'] = stop_timestamp
     174                        myAttrs['nodes'] = nodeslist
     175                        myAttrs['domain'] = string.join( socket.getfqdn().split( '.' )[1:], '.' )
    164176
    165177                        if self.jobDataChanged( jobs, job_id, myAttrs ):
     
    169181
    170182                                debug_msg( 10, printTime() + ' job %s state changed' %(job_id) )
    171 
    172                 #for id, attrs in jobs.items():
    173 
    174                 #       # This job was there in the last run, and not anymore
    175                 #       # it must have finished
    176 
    177                 #       if id not in jobs_processed and attrs['stop_timestamp'] == '':
    178 
    179                 #               jobs[ id ]['status'] = 'F'
    180                 #               jobs[ id ]['stop_timestamp'] = time.time()
    181                 #               debug_msg( 10, printTime() + ' job %s finished' %(id) )
    182                 #               self.printJob( jobs, id )
    183183
    184184                return jobs
     
    199199                        for val in gmetric_val:
    200200                                self.dp.multicastGmetric( 'TOGA-JOB-' + jobid, val )
     201
     202        def makeNodeString( self, nodelist ):
     203
     204                node_str = None
     205
     206                for node in nodelist:
     207                        if not node_str:
     208                                node_str = node
     209                        else:
     210                                node_str = node_str + ';' + node
     211
     212                return node_str
    201213
    202214        def compileGmetricVal( self, jobid, jobattrs ):
     
    211223                status_str = 'status=' + jobattrs['status']
    212224                stime_str = 'stime=' + jobattrs['start_timestamp']
    213 
    214                 appendList = [ name_str, queue_str, owner_str, rtime_str, rmem_str, ppn_str, status_str, stime_str ]
     225                domain_str = 'domain=' + jobattrs['domain']
     226                node_str = 'nodes=' + self.makeNodeString( jobattrs['nodes'] )
     227
     228                appendList = [ name_str, queue_str, owner_str, rtime_str, rmem_str, ppn_str, status_str, stime_str, domain_str, node_str ]
    215229
    216230                return self.makeAppendLists( appendList )
Note: See TracChangeset for help on using the changeset viewer.