Changeset 190
- Timestamp:
- 05/14/09 13:11:08 (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/new_interface.py
r74 r190 16 16 17 17 p = PBSQuery() 18 19 nodes = p.getnodes() 20 for name, node in nodes.items(): 21 print node 22 if node.is_free(): 23 print "%s : Found an free node" %name 18 p.new_data_structure() 24 19 25 20 jobs = p.getjobs() 26 for name, job in jobs.items(): 27 for key in job.keys(): 28 print '%s = %s' %(key, job[key]) 29 21 for id in jobs: 22 print id + ':' 23 for attr in jobs[id]: 24 print '\t' + attr, jobs[id][attr] 25 30 26 l = ['state', 'np' ] 31 27 nodes = p.getnodes(l) 32 for node in nodes.values(): 33 print node 28 for id in nodes: 29 print id + ': ', nodes[id].state, nodes[id].np 30 31 for attrib in nodes[id]: 32 print attrib, nodes[id][attrib] 34 33 35 34 main() -
trunk/src/PBSQuery.py
r188 r190 180 180 new[key] = dict() 181 181 for v in values: 182 a,b = v.split('=') 183 new[key][a] = [ b ] 182 # First argument is the key and the rest is the value 183 # - value can contain a '=' 184 # 185 tmp = v.split('=') 186 new[key][ tmp[0] ] = [ tmp[1:] ] 184 187 185 188 self._free(l) … … 318 321 error = 'invalid attribute %s' %(name) 319 322 raise PBSError(error) 323 324 def __iter__(self): 325 return iter(self.data.keys()) 320 326 321 327 def uniq(self, list):
Note: See TracChangeset
for help on using the changeset viewer.