Skip to content

Commit c71259a

Browse files
committed
Log error
1 parent c85e94a commit c71259a

File tree

3 files changed

+53
-18
lines changed

3 files changed

+53
-18
lines changed

fabfile.py

+50-15
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ def dyn_server_role():
3333
else:
3434
return servers[:env.slimit]
3535

36+
def dyn_client_role():
37+
if "climit" not in env:
38+
return clients
39+
else:
40+
return clients[:env.climit]
41+
3642

3743
env.roledefs.update({
3844
'servers': dyn_server_role, #servers,
39-
'clients': clients
45+
'clients': dyn_client_role
4046
})
4147

4248
from collections import defaultdict
@@ -86,7 +92,21 @@ def time():
8692

8793
f = file("remote_timings.txt", "w")
8894
for k, v in env.timings.iteritems():
89-
f.write("%s %2.4f %2.4f\n" % (k, np.mean(v), np.std(v)))
95+
f.write("%s %2.4f %2.4f\n" % (k, np.mean(v), np.std(v)))
96+
# f.close()
97+
98+
@roles("servers")
99+
@parallel
100+
def cpu():
101+
out = run("sysbench --test=cpu --cpu-max-prime=2000 run")
102+
f = file("cpu.txt", "a")
103+
f.write(out)
104+
f.close()
105+
106+
@runs_once
107+
def local_cpu():
108+
local("sysbench --test=cpu --cpu-max-prime=2000 run")
109+
90110

91111
def null():
92112
pass
@@ -117,14 +137,25 @@ def start():
117137
@parallel
118138
def clean():
119139
with cd('/home/ubuntu/projects/rscoin'):
120-
run('rm log-*')
140+
run('rm -rf experiment*')
121141
run('rm keys-*')
122142

123143
@roles("servers", "clients")
124144
@parallel
125145
def stop():
126146
with cd('/home/ubuntu/projects/rscoin'):
127-
run('kill `cat twistd.pid`')
147+
with settings(warn_only=True):
148+
149+
try:
150+
out = run('ps -u ubuntu')
151+
if "twistd" in out:
152+
out = run('ps -u ubuntu | grep "twis"')
153+
pid = out.strip().split()[0]
154+
run('kill %s' % pid)
155+
except:
156+
pass
157+
# print out
158+
128159

129160
@roles("servers")
130161
def keys():
@@ -167,14 +198,15 @@ def loadsecret():
167198
def passcache():
168199
# Delete old folder and make a new one
169200
sudo( 'rm -rf /home/ubuntu/projects/rscoin')
201+
sudo("apt-get install -y sysbench")
170202

171203
with cd('/home/ubuntu/projects'):
172204
sudo('pip install petlib --upgrade')
173205
run("git clone https://github.com/gdanezis/rscoin.git")
174206

175207
@runs_once
176208
def init():
177-
local("grep rsa ~/.ssh/known_hosts > known_hosts")
209+
# local("grep rsa ~/.ssh/known_hosts > known_hosts")
178210
local("python derivekey.py --store")
179211
execute(passcache)
180212

@@ -218,7 +250,7 @@ def experiment1run():
218250
run("python simscript.py %s payments.txt" % env.messages)
219251
run("rm -rf %s" % env.expname)
220252
run("mkdir %s" % env.expname)
221-
run("./rsc.py --play payments.txt-issue > %s/issue-times.txt" % env.expname)
253+
run("./rsc.py --play payments.txt-issue --conn 10 > %s/issue-times.txt" % env.expname)
222254
# run("./rsc.py --play payments.txt-r1 > experiment1/r1-times.txt")
223255

224256
@roles("clients")
@@ -232,7 +264,7 @@ def experiment1pre():
232264
@parallel
233265
def experiment1actual():
234266
with cd('/home/ubuntu/projects/rscoin'):
235-
run("./rsc.py --play payments.txt-r2 --conn 20 > %s/r2-times.txt" % env.expname)
267+
run("./rsc.py --play payments.txt-r2 --conn 30 > %s/r2-times.txt" % env.expname)
236268

237269

238270
@roles("clients")
@@ -263,9 +295,9 @@ def experiment2():
263295
local("rm -rf experiment2")
264296
local("mkdir experiment2")
265297

266-
local("python simscript.py 200 payments.txt")
298+
local("python simscript.py 1000 payments.txt")
267299
local("./rsc.py --play payments.txt-issue > experiment2/issue-times.txt")
268-
local("./rsc.py --play payments.txt-r1 --conn 20 > experiment2/r1-times.txt")
300+
local("./rsc.py --play payments.txt-r1 --conn 30 > experiment2/r1-times.txt")
269301
# local("python -m cProfile -s tottime rsc.py --play payments.txt-r2 > experiment2/r2-times.txt")
270302
local("./rsc.py --play payments.txt-r2 > experiment2/r2-times.txt")
271303

@@ -279,7 +311,10 @@ def experiment3():
279311

280312
env.messages = 1000
281313

282-
for i in range(29, len(servers)+1):
314+
## Use 20 clients
315+
env.climit = 20
316+
317+
for i in [10, 15, 20, 25, 30]: # range(1, len(servers)+1):
283318

284319
env.expname = "experiment3x%03d" % i
285320
with settings(warn_only=True):
@@ -320,8 +355,8 @@ def experiment3():
320355

321356

322357

323-
@roles("servers")
324-
def exp3each():
325-
print "Hello: %s" % env.host
326-
execute(keys)
327-
execute(loaddir)
358+
#@roles("servers")
359+
#def exp3each():
360+
# print "Hello: %s" % env.host
361+
# execute(keys)
362+
# execute(loaddir)

rsc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ def main():
300300
cores += [ c ]
301301

302302
def play_another_song(var):
303-
# if var:
304-
# print var
303+
if var:
304+
print "ERROR", var
305305

306306
if cores != []:
307307
c = cores.pop()

rscoin/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def export(self):
6262
if self.sec is not None:
6363
sec = self.sec.binary()
6464
return (self.pub.export(EcPt.POINT_CONVERSION_UNCOMPRESSED), sec)
65-
# return (self.pub.export(EcPt.POINT_CONVERSION_COMPRESSED), sec)
65+
6666

6767

6868
# Named structures

0 commit comments

Comments
 (0)