Changeset 194


Ignore:
Timestamp:
05/18/09 16:51:18 (15 years ago)
Author:
bas
Message:

examples/new_rack_pbsmon.py:

  • ported to new data structure
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/new_rack_pbsmon.py

    r186 r194  
    6666                sys.exit(-1)
    6767
     68        p.new_data_structure()
     69
    6870# get the state of the nodes
    6971        attr = [ 'state', 'jobs', 'properties' ]
     
    7779        node_dict = {}
    7880
    79         for nodename, node in nodes.items():
     81        for id in nodes:
    8082
    8183                # Skip login nodes in status display
    8284                #
    83                 if not nodename.find('login'):
    84                         continue
    85 
    86                 state = node['state']
    87                 if string.find(state, ',') >= 0:                        # multiple states for a node?
    88                         state_list = string.split(state, ',')
    89                         if pbs.ND_down in state_list:
    90                                 state = pbs.ND_down
    91                         else:
    92                                 state = string.split(state, ',')[-1]
    93                                
     85                if not nodes[id].name.find('login'):
     86                        continue
     87
     88                if pbs.ND_down in nodes[id].state:
     89                        state = pbs.ND_down
     90                else:
     91                        state = nodes[id].state[0]
    9492
    9593                state_char = PBS_STATES[state]
    9694
    97                 if node.is_free() and node.has_job():           # single job
     95#               print 'TD: ', nodes[id].name, nodes[id].is_free() ,nodes[id].has_job()
     96
     97                if nodes[id].is_free() and nodes[id].has_job():         # single job
    9898#                       print 'TD: %s' % nodename, node
    9999                        state_char = PBS_STATES[pbs_ND_single]
    100100
    101101#               print 'TD: %s %s' % (nodename, state_char)
    102                 dummy = string.split(nodename, '-')
     102                dummy = string.split(nodes[id].name, '-')
    103103                node_dict[dummy[1]] = state_char
    104104
Note: See TracChangeset for help on using the changeset viewer.