Ignore:
Timestamp:
05/14/09 13:11:08 (15 years ago)
Author:
bas
Message:

src/PBSQuery.py:

  • fixed an error in parsing for new data structure, value can contain a '=' char
  • added the iter method

examples/new_interface.py:

  • make use of new data structure and iter object
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/new_interface.py

    r74 r190  
    1616
    1717  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()
    2419
    2520  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     
    3026  l = ['state', 'np' ]
    3127  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]
    3433
    3534main()
Note: See TracChangeset for help on using the changeset viewer.