Skip to content
Snippets Groups Projects
Commit 24715f2f authored by David Verelst's avatar David Verelst
Browse files

remove print statement brackets for PY3 compat again: prints prettier

parent d111a8be
No related branches found
No related tags found
No related merge requests found
...@@ -22,14 +22,14 @@ def print_dashboard(users, host, pbsnodes): ...@@ -22,14 +22,14 @@ def print_dashboard(users, host, pbsnodes):
# jber 3 0 0 0 # jber 3 0 0 0
print print
print ('-' * 54) print '-' * 54
print ('cpus'.rjust(18) + 'nodes'.rjust(9)) print 'cpus'.rjust(18) + 'nodes'.rjust(9)
print ('User'.rjust(9) + 'Running'.rjust(9) + 'Running'.rjust(9) \ print 'User'.rjust(9) + 'Running'.rjust(9) + 'Running'.rjust(9) \
+ 'Queued'.rjust(9) + 'Waiting'.rjust(9) + 'Other'.rjust(9)) + 'Queued'.rjust(9) + 'Waiting'.rjust(9) + 'Other'.rjust(9)
# nodeSum: overview (summation of all jobs) nodes per user: # nodeSum: overview (summation of all jobs) nodes per user:
# nodeSum = [running, queued, waiting, other, cpus] # nodeSum = [running, queued, waiting, other, cpus]
nodeSum = [0, 0, 0, 0, 0] nodeSum = [0, 0, 0, 0, 0]
print ('-' * 54) print '-' * 54
# print all values in the table: the nodes used per user # print all values in the table: the nodes used per user
#userlist = users['users'].keys() #userlist = users['users'].keys()
#userlist.sort() #userlist.sort()
...@@ -47,8 +47,8 @@ def print_dashboard(users, host, pbsnodes): ...@@ -47,8 +47,8 @@ def print_dashboard(users, host, pbsnodes):
+ users[uid]['S'] + users[uid]['O'] + users[uid]['C'] + users[uid]['S'] + users[uid]['O'] + users[uid]['C']
cpus = users[uid]['cpus'] cpus = users[uid]['cpus']
print (uid.rjust(9) + str(cpus).rjust(9) + str(R).rjust(9) \ print uid.rjust(9) + str(cpus).rjust(9) + str(R).rjust(9) \
+ str(Q).rjust(9) + str(W).rjust(9) + str(O).rjust(9)) + str(Q).rjust(9) + str(W).rjust(9) + str(O).rjust(9)
nodeSum[0] += R nodeSum[0] += R
nodeSum[1] += Q nodeSum[1] += Q
nodeSum[2] += W nodeSum[2] += W
...@@ -61,15 +61,15 @@ def print_dashboard(users, host, pbsnodes): ...@@ -61,15 +61,15 @@ def print_dashboard(users, host, pbsnodes):
total_cpu = host['cpu_per_node'] * nr_nodes total_cpu = host['cpu_per_node'] * nr_nodes
# the summed up for each node status (queued, running,...) # the summed up for each node status (queued, running,...)
print ('-' * 54) print '-' * 54
print ('total'.rjust(9) + str(nodeSum[4]).rjust(9) + str(nodeSum[0]).rjust(9) \ print 'total'.rjust(9) + str(nodeSum[4]).rjust(9) + str(nodeSum[0]).rjust(9) \
+ str(nodeSum[1]).rjust(9) + str(nodeSum[2]).rjust(9)\ + str(nodeSum[1]).rjust(9) + str(nodeSum[2]).rjust(9)\
+ str(nodeSum[3]).rjust(9)) + str(nodeSum[3]).rjust(9)
print ('-' * 54) print '-' * 54
print ('free'.rjust(9) + str(total_cpu - nodeSum[4]).rjust(9) \ print 'free'.rjust(9) + str(total_cpu - nodeSum[4]).rjust(9) \
+ str(nr_nodes - nodeSum[0] - others - down).rjust(9)) + str(nr_nodes - nodeSum[0] - others - down).rjust(9)
print ('down'.rjust(9) + str(down).rjust(18)) print 'down'.rjust(9) + str(down).rjust(18)
print ('-' * 54) print '-' * 54
print print
...@@ -79,7 +79,7 @@ def print_node_loading(users, host, nodes, nodesload): ...@@ -79,7 +79,7 @@ def print_node_loading(users, host, nodes, nodesload):
""" """
if len(host) < 1: if len(host) < 1:
print ('It is very quit, nobody is working on the cluster.') print 'It is very quit, nobody is working on the cluster.'
return return
hostname = host['name'] hostname = host['name']
...@@ -88,15 +88,15 @@ def print_node_loading(users, host, nodes, nodesload): ...@@ -88,15 +88,15 @@ def print_node_loading(users, host, nodes, nodesload):
print print
# print a header # print a header
if hostname == 'gorm': if hostname == 'gorm':
print ('-' * 79) print '-' * 79
header = '|'.join([str(k).center(5) for k in range(1, 13, 1)]) + '|' header = '|'.join([str(k).center(5) for k in range(1, 13, 1)]) + '|'
print ('id'.center(5), header) print 'id'.center(5), header
print ('-' * 79) print '-' * 79
elif hostname == 'jess': elif hostname == 'jess':
print ('-' * 126) print '-' * 126
header = '|'.join([str(k).center(5) for k in range(1, 21, 1)]) + '|' header = '|'.join([str(k).center(5) for k in range(1, 21, 1)]) + '|'
print ('id'.center(5), header) print 'id'.center(5), header
print ('-' * 126) print '-' * 126
# print who is using the nodes # print who is using the nodes
for node in sorted(nodes): for node in sorted(nodes):
...@@ -112,17 +112,17 @@ def print_node_loading(users, host, nodes, nodesload): ...@@ -112,17 +112,17 @@ def print_node_loading(users, host, nodes, nodesload):
except KeyError: except KeyError:
printlist = status.center(5) printlist = status.center(5)
print (node, printlist) print node, printlist
# print a header # print a header
if hostname == 'gorm': if hostname == 'gorm':
print ('-' * 79) print '-' * 79
print ('id'.center(5), header) print 'id'.center(5), header
print ('-' * 79) print '-' * 79
elif hostname == 'jess': elif hostname == 'jess':
print ('-' * 126) print '-' * 126
print ('id'.center(5), header) print 'id'.center(5), header
print ('-' * 126) print '-' * 126
#print #print
...@@ -342,8 +342,8 @@ def create_input(walltime='00:59:59', queue='xpresq', pbs_in='pbs_in/', ppn=1, ...@@ -342,8 +342,8 @@ def create_input(walltime='00:59:59', queue='xpresq', pbs_in='pbs_in/', ppn=1,
pbs_script = pbs_script.replace('[queue]', queue) pbs_script = pbs_script.replace('[queue]', queue)
pbs_script = pbs_script.replace('[commands]', commands) pbs_script = pbs_script.replace('[commands]', commands)
print ('following commands will be executed on the cluster:') print 'following commands will be executed on the cluster:'
print ('%s' % (commands)) print '%s' % (commands)
# make sure a pbs_in and pbs_out directory exists # make sure a pbs_in and pbs_out directory exists
if not os.path.exists(pbs_in): if not os.path.exists(pbs_in):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment