source: trunk/examples/new_interface.py @ 356

Last change on this file since 356 was 356, checked in by martijk, 6 years ago

python3 compatible print #26732

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