Skip to content

Commit 4848fad

Browse files
committed
formatted aggregation in tests
1 parent cbdb2d1 commit 4848fad

File tree

2 files changed

+32
-17
lines changed

2 files changed

+32
-17
lines changed

contrib/mmts/tests2/lib/bank_client.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import print_function
12
import psycopg2
23
import random
34
from multiprocessing import Process, Value, Queue
@@ -30,6 +31,36 @@ def stop(self):
3031
for client in self._clients:
3132
client.stop()
3233

34+
def print_agg(self):
35+
aggs = []
36+
for client in self._clients:
37+
aggs.append(client.history.aggregate())
38+
39+
columns = ['running', 'running_latency', 'max_latency', 'finish']
40+
41+
#rows = [ k+str(i+1) for k in agg.keys() for i, agg in enumerate(aggs)]
42+
43+
print("\t\t", end="")
44+
for col in columns:
45+
print(col, end="\t")
46+
print("\n", end="")
47+
48+
for i, agg in enumerate(aggs):
49+
for k in agg.keys():
50+
print("%s_%d:\t" % (k, i+1), end="")
51+
for col in columns:
52+
if k in agg and col in agg[k]:
53+
if isinstance(agg[k][col], float):
54+
print("%.2f\t" % (agg[k][col],), end="\t")
55+
#print(agg[k][col], end="\t")
56+
else :
57+
print(agg[k][col], end="\t")
58+
else :
59+
print("-\t", end='')
60+
print("\n", end='')
61+
62+
print("")
63+
3364

3465
class BankClient(object):
3566

contrib/mmts/tests2/test_recovery.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,9 @@ def test_1_node_disconnect(self):
3535
subprocess.check_call(['blockade','partition','node3'])
3636
print('Node3 disconnected')
3737

38-
print('Waiting 15s to discover failure')
39-
40-
for i in range(5):
41-
time.sleep(3)
42-
for client in self.clients:
43-
agg = client.history.aggregate()
44-
print(agg)
45-
print(" ")
46-
47-
# subprocess.check_call(['blockade','join'])
48-
49-
print('Waiting 15s to join node')
5038
for i in range(1000):
5139
time.sleep(3)
52-
for client in self.clients:
53-
agg = client.history.aggregate()
54-
print(agg)
55-
print(" ")
56-
40+
self.clients.print_agg()
5741

5842
if __name__ == '__main__':
5943
unittest.main()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy