Changeset 63
- Timestamp:
- 10/21/04 14:11:30 (19 years ago)
- Location:
- trunk/pbs_swig/distro/examples
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/pbs_swig/distro/examples/pbsmon.py
r54 r63 16 16 import pbs 17 17 18 pbs_ND_free_and_job = 'not_all_procs_used' 19 18 20 translate_state = { 19 21 pbs.ND_free : '_', … … 26 28 pbs.ND_state_unknown : '?', 27 29 pbs.ND_timeshared : 'T', 28 pbs.ND_cluster : 'C' 30 pbs.ND_cluster : 'C', 31 pbs_ND_free_and_job : 'j' 29 32 } 30 33 … … 37 40 # 38 41 if len(nl) == 1: 42 print nl[0] 39 43 width = len( nl[0] ) 40 44 else: 45 print nl[0] 41 46 width = len( nl[1] ) 42 47 … … 81 86 for key in translate_state.keys(): 82 87 value = translate_state[key] 83 print "% 2s %-15s : %d\t |" %( value, key, sl.count(value) ),88 print "%3s %-21s : %d\t |" %( value, key, sl.count(value) ), 84 89 if n%2: 85 90 print '' … … 104 109 sys.exit(1) 105 110 106 # We are only interested in the state of a node111 # We are only interested in the state and jobs of a node 107 112 # 108 attrl = pbs.new_attrl( 1);113 attrl = pbs.new_attrl(2); 109 114 attrl[0].name='state' 115 attrl[1].name = 'jobs' 110 116 111 117 … … 123 129 # 124 130 temp = string.splitfields(node_attr[0].value, ',') 125 state_list.append(translate_state[ temp[0] ]) 131 state = temp[0] 132 state_list.append(translate_state[state]) 126 133 134 # look if on a free node a job is scheduled 135 # 136 if state == pbs.ND_free: 137 if len(node_attr) > 1: 138 state_list.append(translate_state[pbs_ND_free_and_job]) 139 else: 140 state_list.append(translate_state[state]) 141 else: 142 state_list.append(translate_state[state]) 143 144 127 145 re_host = re.compile(r""" 128 146 … … 132 150 133 151 result = re_host.search(node.name) 152 result = None 134 153 if result: 154 print 'bas' 135 155 node_list.append( result.group('name') ) 136 156 else:
Note: See TracChangeset
for help on using the changeset viewer.