source: trunk/examples/set_property.py @ 356

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

python3 compatible print #26732

  • Property svn:keywords set to Id
File size: 772 bytes
Line 
1#!/usr/bin/env python
2#
3# Author: Bas van der Vlies <basv@sara.nl>
4# Date  : 17 Aug 2001
5# Desc. : Set a node property
6#
7# CVS info:
8# $Id: set_property.py 356 2018-04-11 11:57:42Z martijk $
9#
10#
11#
12import sys
13import pbs
14
15def main():
16  pbs_server = pbs.pbs_default()
17  if not pbs_server:
18    print('No default server')
19    sys.exit(1)
20
21  if len(sys.argv) < 2:
22        print("Usage: set_property.py <hostname>")
23        sys.exit(1)
24
25  hostname = sys.argv[1]
26
27  con = pbs.pbs_connect(pbs_server)
28
29  attrop_l = pbs.new_attropl(1)
30  attrop_l[0].name  = 'note'
31  attrop_l[0].value = 'set_something_useful'
32  attrop_l[0].op    = pbs.SET
33
34  r =  pbs.pbs_manager(con, pbs.MGR_CMD_SET, pbs.MGR_OBJ_NODE, 
35                    hostname, attrop_l, 'NULL')
36
37  if r > 0:
38    print(r, ";")
39    errno, text = pbs.error() 
40    print(errno, text)
41
42main()
Note: See TracBrowser for help on using the repository browser.