Changeset 361


Ignore:
Timestamp:
04/12/18 13:27:11 (6 years ago)
Author:
martijk
Message:

import print function form future (python 3)

Location:
trunk/examples
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/JobParser.py

    r356 r361  
    66#               and convert them to a attropl list which can be used for submission
    77#
    8 
     8from __future__ import print_function
    99import re
    1010import sys
  • trunk/examples/ha_server.py

    r356 r361  
    1111#
    1212import sys
    13 
     13from __future__ import print_function
    1414import pbs
    1515
    1616def method1():
    17         pbs_server = pbs.pbs_default()
    18         if not pbs_server:
    19                 print("No default pbs server")
    20                 sys.exit(1)
     17    pbs_server = pbs.pbs_default()
     18    if not pbs_server:
     19        print("No default pbs server")
     20        sys.exit(1)
    2121
    22         con = pbs.pbs_connect(pbs_server)
    23         if con == -1:
    24                 print("Default pbs server connection failed")
    25                 pbs_server = pbs.pbs_fbserver()
    26                 if not pbs_server:
    27                         print("No pbs fallback server")
    28                         sys.exit(1)
    29                 else:
    30                         con = pbs.pbs_connect(pbs_server)
    31                         if con == -1:
    32                                 print("pbs fallback server connection failed")
    33                                 sys.exit(1)
     22    con = pbs.pbs_connect(pbs_server)
     23    if con == -1:
     24        print("Default pbs server connection failed")
     25        pbs_server = pbs.pbs_fbserver()
     26        if not pbs_server:
     27            print("No pbs fallback server")
     28            sys.exit(1)
     29        else:
     30            con = pbs.pbs_connect(pbs_server)
     31            if con == -1:
     32                print("pbs fallback server connection failed")
     33                sys.exit(1)
    3434
    35         print("Connected to %s" %(pbs_server))
     35    print("Connected to %s" %(pbs_server))
    3636
    3737def method2():
    38         try:
    39                 server_list = pbs.pbs_get_server_list().split(',')
    40         except AttributeError, detail:
    41                 print('The installed torque version does not support pbs_get_server_list function')
    42                 sys.exit(1)
    43         for server in server_list:
    44                 pbs_server = server
    45                 con = pbs.pbs_connect(server)
    46                 if con != -1:
    47                         break
     38    try:
     39        server_list = pbs.pbs_get_server_list().split(',')
     40    except AttributeError, detail:
     41        print('The installed torque version does not support pbs_get_server_list function')
     42        sys.exit(1)
     43    for server in server_list:
     44        pbs_server = server
     45        con = pbs.pbs_connect(server)
     46        if con != -1:
     47            break
    4848
    49         if con == -1:
    50                 print('Could not connect to a server (%s)' %('.'.join(server_list)))
    51                 sys.exit(1)
     49    if con == -1:
     50        print('Could not connect to a server (%s)' %('.'.join(server_list)))
     51        sys.exit(1)
    5252
    53         print("Connected to %s" %(pbs_server))
     53    print("Connected to %s" %(pbs_server))
    5454
    5555
  • trunk/examples/logpbs.py

    r356 r361  
    77# $Id$
    88#
     9from __future__ import print_function
    910import pbs
    1011import sys
  • trunk/examples/new_interface.py

    r356 r361  
    1010#
    1111#
    12 
     12from __future__ import print_function
    1313import pbs
    1414from PBSQuery import PBSQuery
     
    4141  #nodes = p.getnodes(l)
    4242  for id in nodes:
    43         print(id)
     43    print(id)
    4444
    45         try:
    46                 print(nodes[id].np)
    47                 print(nodes[id].status.arch)
    48                 print(nodes[id].status.uname)
    49                 print(nodes[id].state)
    50         except PBSError, detail:
    51                 print(detail)
    52                 pass
    53        
     45    try:
     46        print(nodes[id].np)
     47        print(nodes[id].status.arch)
     48        print(nodes[id].status.uname)
     49        print(nodes[id].state)
     50    except PBSError, detail:
     51        print(detail)
     52        pass
     53   
    5454     #for attrib in nodes[id]:
    55      #  print attrib, nodes[id][attrib]
     55     #  print attrib, nodes[id][attrib]
    5656
    5757main()
  • trunk/examples/new_rack_pbsmon.py

    r321 r361  
    2727The ranges ([]) are not only limited to numbers, letters can also be used.
    2828"""
    29 
     29from __future__ import print_function
    3030import sys
    3131import re
  • trunk/examples/node_event_parse.py

    r356 r361  
    1212#
    1313
    14 
     14from __future__ import print_function
    1515import pbs
    1616import sys
  • trunk/examples/pbs_version.py

    r356 r361  
    88#
    99#
     10from __future__ import print_function
    1011import sys
    1112import pbs
  • trunk/examples/pbsnodes-a.py

    r356 r361  
    1111#
    1212
    13 
     13from __future__ import print_function
    1414import pbs
    1515import sys
  • trunk/examples/resmom_info.py

    r356 r361  
    77# $Id$
    88#
     9from __future__ import print_function
    910import pbs
    1011import sys
  • trunk/examples/sara_nodes.py

    r346 r361  
    1818ALLOWED_STATES = set(['down', 'offline', 'unknown'])
    1919
     20from __future__ import print_function
    2021import pbs
    2122import PBSQuery
  • trunk/examples/set_property.py

    r356 r361  
    1010#
    1111#
     12from __future__ import print_function
    1213import sys
    1314import pbs
     
    2021
    2122  if len(sys.argv) < 2:
    22         print("Usage: set_property.py <hostname>")
    23         sys.exit(1)
     23    print("Usage: set_property.py <hostname>")
     24    sys.exit(1)
    2425
    2526  hostname = sys.argv[1]
Note: See TracChangeset for help on using the changeset viewer.