Changeset 661 for trunk/jobmond


Ignore:
Timestamp:
09/04/12 11:23:16 (12 years ago)
Author:
ramonb
Message:
  • also report Waiting jobs
  • renamed some metrics to make more sense
  • more PBS info
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/jobmond/jobmond.py

    r660 r661  
    289289    except ConfigParser.NoOptionError:
    290290
    291         # Not specified: assume /etc/gmond.conf
     291        # Not specified: assume /etc/ganglia/gmond.conf
    292292        #
    293         GMOND_CONF      = '/etc/gmond.conf'
     293        GMOND_CONF      = '/etc/ganglia/gmond.conf'
    294294
    295295    ganglia_cfg     = GangliaConfigParser( GMOND_CONF )
     
    881881
    882882# Abstracted from PBS original.
    883 # Fixme:  Is it worth (or appropriate for PBS) sorting the result?
    884883#
    885884def do_nodelist( nodes ):
     
    12321231            job_id          = name.split( '.' )[0]
    12331232
     1233            owner           = self.getAttr( attrs, 'Job_Owner' )
    12341234            name            = self.getAttr( attrs, 'Job_Name' )
    12351235            queue           = self.getAttr( attrs, 'queue' )
    1236 
    1237             if QUEUE:
    1238                 for q in QUEUE:
    1239                     if q == queue:
    1240                         display_queue = 1
    1241                         break
    1242                     else:
    1243                         display_queue = 0
    1244                         continue
    1245             if display_queue == 0:
    1246                 continue
    1247 
    1248 
    1249             owner           = self.getAttr( attrs, 'Job_Owner' ).split( '@' )[0]
     1236            nodect          = self.getAttr( attrs['nodes'], 'nodect' )
     1237            exec_group      = self.getAttr( attrs, 'egroup' )
     1238
    12501239            requested_time      = self.getAttr( attrs['Resource_List'], 'walltime' )
    12511240            requested_memory    = self.getAttr( attrs['Resource_List'], 'mem' )
    12521241
     1242
     1243            requested_nodes     = ''
    12531244            mynoderequest       = self.getAttr( attrs['Resource_List'], 'nodes' )
    12541245
    12551246            ppn         = ''
    1256 
    1257             if mynoderequest.find( ':' ) != -1 and mynoderequest.find( 'ppn' ) != -1:
     1247            attributes  = ''
     1248
     1249            if mynoderequest.find( ':' ) != -1:
    12581250
    12591251                mynoderequest_fields    = mynoderequest.split( ':' )
     
    12611253                for mynoderequest_field in mynoderequest_fields:
    12621254
     1255                    if mynoderequest_field.isdigit():
     1256
     1257                        continue #TODO add requested_nodes if is hostname(s)
     1258
    12631259                    if mynoderequest_field.find( 'ppn' ) != -1:
    12641260
    12651261                        ppn = mynoderequest_field.split( 'ppn=' )[1]
    12661262
     1263                    else:
     1264
     1265                        if attributes == '':
     1266
     1267                            attributes = '%s' %mynoderequest_field
     1268                        else:
     1269                            attributes = '%s:%s' %( attributes, mynoderequest_field )
     1270
    12671271            status          = self.getAttr( attrs, 'job_state' )
    12681272
    1269             if status in [ 'Q', 'R' ]:
     1273            if status in [ 'Q', 'R', 'W' ]:
    12701274
    12711275                jobs_processed.append( job_id )
    12721276
    1273             queued_timestamp    = self.getAttr( attrs, 'ctime' )
     1277            create_timestamp    = self.getAttr( attrs, 'ctime' )
     1278            running_nodes       = ''
     1279            exec_nodestr        = ''
    12741280
    12751281            if status == 'R':
    12761282
    1277                 start_timestamp     = self.getAttr( attrs, 'mtime' )
    1278                 nodes           = self.getAttr( attrs, 'exec_host' ).split( '+' )
    1279 
     1283                #start_timestamp     = self.getAttr( attrs, 'etime' )
     1284                start_timestamp     = self.getAttr( attrs, 'start_time' )
     1285                exec_nodestr        = self.getAttr( attrs, 'exec_host' )
     1286
     1287                nodes           = exec_nodestr.split( '+' )
    12801288                nodeslist       = do_nodelist( nodes )
     1289                running_nodes   = string.join( nodeslist, ' ' )
    12811290
    12821291                if DETECT_TIME_DIFFS:
     
    13061315                start_timestamp     = ''
    13071316                count_mynodes       = 0
     1317
     1318                queued_timestamp    = self.getAttr( attrs, 'qtime' )
    13081319
    13091320                for node in mynoderequest.split( '+' ):
     
    13581369            myAttrs             = { }
    13591370
    1360             myAttrs[ 'name' ]       = str( name )
    1361             myAttrs[ 'queue' ]      = str( queue )
    1362             myAttrs[ 'owner' ]      = str( owner )
    1363             myAttrs[ 'requested_time' ] = str( requested_time )
    1364             myAttrs[ 'requested_memory' ]   = str( requested_memory )
    1365             myAttrs[ 'ppn' ]        = str( ppn )
    1366             myAttrs[ 'status' ]     = str( status )
    1367             myAttrs[ 'start_timestamp' ]    = str( start_timestamp )
    1368             myAttrs[ 'queued_timestamp' ]   = str( queued_timestamp )
    1369             myAttrs[ 'reported' ]       = str( int( int( self.cur_time ) + int( self.timeoffset ) ) )
    1370             myAttrs[ 'nodes' ]      = nodeslist
    1371             myAttrs[ 'domain' ]     = fqdn_parts( socket.getfqdn() )[1]
    1372             myAttrs[ 'poll_interval' ]  = str( BATCH_POLL_INTERVAL )
    1373 
    1374             if self.jobDataChanged( self.jobs, job_id, myAttrs ) and myAttrs['status'] in [ 'R', 'Q' ]:
     1371            myAttrs[ 'name' ]              = str( name )
     1372            myAttrs[ 'status' ]            = str( status )
     1373            myAttrs[ 'queue' ]             = str( queue )
     1374            myAttrs[ 'owner' ]             = str( owner )
     1375            myAttrs[ 'nodect' ]            = str( nodect )
     1376            myAttrs[ 'exec.group' ]        = str( exec_group )
     1377            myAttrs[ 'exec.hostnames' ]    = str( running_nodes )
     1378            myAttrs[ 'exec.nodestr' ]      = str( exec_nodestr )
     1379            myAttrs[ 'req.walltime' ]      = str( requested_time )
     1380            myAttrs[ 'req.memory' ]        = str( requested_memory )
     1381            myAttrs[ 'req.nodes' ]         = str( requested_nodes )
     1382            myAttrs[ 'req.ppn' ]           = str( ppn )
     1383            myAttrs[ 'req.attributes' ]    = str( attributes )
     1384            myAttrs[ 'timestamp.running' ] = str( start_timestamp )
     1385            myAttrs[ 'timestamp.created' ] = str( create_timestamp )
     1386            myAttrs[ 'timestamp.queued' ]  = str( queued_timestamp )
     1387
     1388            if self.jobDataChanged( self.jobs, job_id, myAttrs ) and myAttrs['status'] in [ 'R', 'Q', 'W' ]:
    13751389
    13761390                self.jobs[ job_id ] = myAttrs
Note: See TracChangeset for help on using the changeset viewer.