source: trunk/examples/new_interface.py @ 204

Last change on this file since 204 was 204, checked in by bas, 14 years ago

Show how to use the new data structure.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 846 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 204 2009-11-12 14:20:12Z bas $
9#
10#
11#
12
13from PBSQuery import PBSQuery
14from PBSQuery import PBSError
15
16import sys
17
18def main():
19
20  p = PBSQuery()
21  p.new_data_structure()
22
23  #job = p.getjob('2983215')
24  #print job['substate']
25  #print job.substate
26  #print job.queue
27  #print job.Resource_List
28  #print job.Resource_List.nodes
29  #print job.Resource_List.arch
30  #print job.Variable_List.PBS_O_HOME
31
32  l = ['np', 'status', 'state' ]
33  nodes = p.getnodes(l)
34  for id in nodes:
35        print id
36
37        try:
38                print nodes[id].np
39                print nodes[id].status.arch
40                print nodes[id].status.uname
41                print nodes[id].state
42        except PBSError, detail:
43                print detail
44                pass
45       
46     #for attrib in nodes[id]:
47     #  print attrib, nodes[id][attrib]
48
49main()
Note: See TracBrowser for help on using the repository browser.