source: devel/pbs_node_info

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

Updated all pbs files so we are in sync with the 2.4/2.5 features of torque

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