source: devel/test_attrl.py

Last change on this file was 309, checked in by bas, 8 years ago

Checkin the pbs swig development files

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/usr/bin/python
2
3import sys
4import pbs
5
6def test_init():
7  print 'Test init'
8
9  w = pbs.new_attrl(2)
10  print type(w)
11
12  print 'end Test init'
13
14def test_getitem():
15  print 'Test getitem'
16
17  w = pbs.new_attrl(2)
18  b = w[0]
19  c = w[1]
20
21  print b, type(b)
22
23  b.name = 'bas'
24  b.value = 'vlies'
25  print 'b', b
26
27  c.name = 'cbassssssssssss'
28  c.value = 'cvlies'
29  print 'c', c
30
31def test_loop():
32  print 'Test loop'
33  w = pbs.new_attrl(2)
34  b = w[0]
35  c = w[1]
36
37  b.name = 'bas'
38  b.value = 'vlies'
39  c.name = 'jaap'
40  c.value = 'dijkshoorn'
41
42  for i in w:
43    print i
44
45
46test_init()
47test_getitem()
48test_loop()
49
50pbs_server = pbs.pbs_default()
51con = pbs.pbs_connect(pbs_server)
52print con
53
54z = pbs.new_attrl(2)
55z[0].name = 'state'
56z[1].name = 'ntype'
57
58#z.append('bla');
59#print 'z', z
60
61for entry in z:
62  print 'entry', entry
63
64x = pbs.new_attrl(1)
65x[0].name = 'np'
66
67combine = z + x
68print combine, len(combine)
69
70#print combine[0].name
71#print combine[1].name
72#print combine[2].name
73
74nodes = pbs.pbs_statnode(con, "", 'NULL', "NULL")
75for node in nodes:
76  print node.name, ':'
77  for prop in node.attribs:
78     print '\t', prop.name, ' = ',  prop.value
79
80queues = pbs.pbs_statque(con, "", 'NULL', "")
81for queue in queues:
82  print queue.name
83  for attrib in queue.attribs:
84    print '\t', attrib.name, ' = ',  attrib.value
85
86jobs = pbs.pbs_statjob(con, "", 'NULL', "")
87for job in jobs:
88  print job.name
89  for attrib in job.attribs:
90    print '\t', attrib.name, ' = ',  attrib.value
91
92sys.exit(0)
93
94## OLD stuff obselete
95##
96while batch_info.this:
97  node_attr = batch_info.attribs
98  print batch_info.name, ':'
99  while node_attr.this:
100    # print node_attr.this
101    print '\t', node_attr.name ,node_attr.value
102    node_attr = node_attr.next
103
104  batch_info =  batch_info.next
105
Note: See TracBrowser for help on using the repository browser.