source: trunk/examples/new_interface.py @ 190

Last change on this file since 190 was 190, checked in by bas, 15 years ago

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
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 578 bytes
Line 
1#!/usr/bin/env python
2#
3# Author: Bas van der Vlies <basv@sara.nl>
4# Date  : 02 March 2005
5# Desc. : Usage of the new PBSQuery module
6#
7# SVN info:
8# $Id: new_interface.py 190 2009-05-14 11:11:08Z bas $
9#
10#
11#
12
13from PBSQuery import PBSQuery
14
15def main():
16
17  p = PBSQuery()
18  p.new_data_structure()
19
20  jobs = p.getjobs()
21  for id in jobs:
22     print id + ':'
23     for attr in jobs[id]:
24        print '\t' + attr, jobs[id][attr]
25     
26  l = ['state', 'np' ]
27  nodes = p.getnodes(l)
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]
33
34main()
Note: See TracBrowser for help on using the repository browser.