source: devel/5.X/pbs_node_info @ 335

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

finally version of pbs_python to 5.X, still no working rm interface

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/usr/bin/python
2
3import pbs
4import sys
5import time
6import socket
7
8def main():
9  server = pbs.pbs_default()
10  c      = pbs.pbs_connect(server)
11
12  nodes = pbs.pbs_statnode(c, '', 'NULL', 'NULL')
13  e, txt =  pbs.error()
14  if e:
15    print  "statnode erro: %s" %pbs.pbs_strerror(e)
16    print "txt %s\n" %txt
17
18  for node in nodes:
19    print node.name
20    attrs = node.attribs
21    for attr in attrs:
22      print '\t  ', attr.name, ' = ', attr.value
23
24#    try:
25#      mom_port = socket.getservbyname('pbs_resmom', 'tcp')
26#      mom_id = pbs.openrm(node.name, mom_port)
27#    except socket.error, detail:
28#      mom_id = pbs.openrm(node.name, pbs.PBS_MANAGER_SERVICE_PORT)
29
30    mom_id = pbs.openrm(node.name, pbs.PBS_MANAGER_SERVICE_PORT)
31    e, e_txt = pbs.error()
32    print "openrm", e, e_txt
33    print node.name, mom_id, pbs.PBS_MANAGER_SERVICE_PORT
34    #pbs.flushreq()
35    #pbs.fullresp(1)
36    #e, e_txt = pbs.error()
37    #print "flush", e, e_txt
38
39    #pbs.addreq_err(mom_id, err, "arch")
40    pbs.addreq(mom_id, "arch")
41    e, e_txt = pbs.error()
42    print "addreq:", e, e_txt
43
44    #print pbs.activereq()
45    #e, e_txt = pbs.error()
46    #print "addreq:", e, e_txt
47
48    #resp = pbs.getreq_err(err, mom_id)
49    resp = pbs.getreq(mom_id)
50    e, e_txt = pbs.error()
51    print e, e_txt
52
53    print 'rm interface'
54
55    mom_keys = pbs.get_mom_values(mom_id)
56    for key in mom_keys.keys():
57      print '\t mom %s = %s' %(key, mom_keys[key])
58
59    print 'Testing list with user supplied keywords'
60
61    l = [ 'ncpus', 'loadave' ]
62    mom_keys = pbs.get_mom_values(mom_id, l)
63    for key in mom_keys.keys():
64      print '\t %s = %s' %(key, mom_keys[key])
65
66main()
Note: See TracBrowser for help on using the repository browser.