source: devel/5.X/pbs_node_info @ 324

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

added 5.X setup, must be made better, want to generate a of stuff from the debian installation package, see #47

  • Property svn:executable set to *
File size: 933 bytes
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 txt
16
17  for node in nodes:
18    print node.name
19    attrs = node.attribs
20    for attr in attrs:
21      print '\t', attr.name, ' = ', attr.value
22
23    try:
24      mom_port = socket.getservbyname('pbs_resmom', 'tcp')
25      mom_id = pbs.openrm(node.name, mom_port)
26    except socket.error, detail:
27      mom_id = pbs.openrm(node.name, pbs.PBS_MANAGER_SERVICE_PORT)
28
29    mom_keys = pbs.get_mom_values(mom_id)
30    for key in mom_keys.keys():
31      print '\t %s = %s' %(key, mom_keys[key])
32
33    print 'Testing list with user supplied keywords'
34
35    l = [ 'ncpus', 'loadave' ]
36    mom_keys = pbs.get_mom_values(mom_id, l)
37    for key in mom_keys.keys():
38      print '\t %s = %s' %(key, mom_keys[key])
39
40main()
Note: See TracBrowser for help on using the repository browser.