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):
# jber 3 0 0 0
print
print ('-' * 54)
print ('cpus'.rjust(18) + 'nodes'.rjust(9))
print ('User'.rjust(9) + 'Running'.rjust(9) + 'Running'.rjust(9) \
+ 'Queued'.rjust(9) + 'Waiting'.rjust(9) + 'Other'.rjust(9))
print '-' * 54
print 'cpus'.rjust(18) + 'nodes'.rjust(9)
print 'User'.rjust(9) + 'Running'.rjust(9) + 'Running'.rjust(9) \
+ 'Queued'.rjust(9) + 'Waiting'.rjust(9) + 'Other'.rjust(9)
# nodeSum: overview (summation of all jobs) nodes per user:
# nodeSum = [running, queued, waiting, other, cpus]
nodeSum = [0, 0, 0, 0, 0]
print ('-' * 54)
print '-' * 54
# print all values in the table: the nodes used per user
#userlist = users['users'].keys()
#userlist.sort()
......@@ -47,8 +47,8 @@ def print_dashboard(users, host, pbsnodes):
+ users[uid]['S'] + users[uid]['O'] + users[uid]['C']
cpus = users[uid]['cpus']
print (uid.rjust(9) + str(cpus).rjust(9) + str(R).rjust(9) \
+ str(Q).rjust(9) + str(W).rjust(9) + str(O).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)
nodeSum[0] += R
nodeSum[1] += Q
nodeSum[2] += W
......@@ -61,15 +61,15 @@ def print_dashboard(users, host, pbsnodes):
total_cpu = host['cpu_per_node'] * nr_nodes
# the summed up for each node status (queued, running,...)
print ('-' * 54)
print ('total'.rjust(9) + str(nodeSum[4]).rjust(9) + str(nodeSum[0]).rjust(9) \
print '-' * 54
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[3]).rjust(9))
print ('-' * 54)
print ('free'.rjust(9) + str(total_cpu - nodeSum[4]).rjust(9) \
+ str(nr_nodes - nodeSum[0] - others - down).rjust(9))
print ('down'.rjust(9) + str(down).rjust(18))
print ('-' * 54)
+ str(nodeSum[3]).rjust(9)
print '-' * 54
print 'free'.rjust(9) + str(total_cpu - nodeSum[4]).rjust(9) \
+ str(nr_nodes - nodeSum[0] - others - down).rjust(9)
print 'down'.rjust(9) + str(down).rjust(18)
print '-' * 54
print
......@@ -79,7 +79,7 @@ def print_node_loading(users, host, nodes, nodesload):
"""
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
hostname = host['name']
......@@ -88,15 +88,15 @@ def print_node_loading(users, host, nodes, nodesload):
print
# print a header
if hostname == 'gorm':
print ('-' * 79)
print '-' * 79
header = '|'.join([str(k).center(5) for k in range(1, 13, 1)]) + '|'
print ('id'.center(5), header)
print ('-' * 79)
print 'id'.center(5), header
print '-' * 79
elif hostname == 'jess':
print ('-' * 126)
print '-' * 126
header = '|'.join([str(k).center(5) for k in range(1, 21, 1)]) + '|'
print ('id'.center(5), header)
print ('-' * 126)
print 'id'.center(5), header
print '-' * 126
# print who is using the nodes
for node in sorted(nodes):
......@@ -112,17 +112,17 @@ def print_node_loading(users, host, nodes, nodesload):
except KeyError:
printlist = status.center(5)
print (node, printlist)
print node, printlist
# print a header
if hostname == 'gorm':
print ('-' * 79)
print ('id'.center(5), header)
print ('-' * 79)
print '-' * 79
print 'id'.center(5), header
print '-' * 79
elif hostname == 'jess':
print ('-' * 126)
print ('id'.center(5), header)
print ('-' * 126)
print '-' * 126
print 'id'.center(5), header
print '-' * 126
#print
......@@ -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('[commands]', commands)
print ('following commands will be executed on the cluster:')
print ('%s' % (commands))
print 'following commands will be executed on the cluster:'
print '%s' % (commands)
# make sure a pbs_in and pbs_out directory exists
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