Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
2c22c7d9
Commit
2c22c7d9
authored
9 years ago
by
Simon Désaulniers
Browse files
Options
Downloads
Patches
Plain Diff
more code refactoring
parent
6c3c19c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/tools/benchmark.py
+148
-161
148 additions, 161 deletions
python/tools/benchmark.py
with
148 additions
and
161 deletions
python/tools/benchmark.py
+
148
−
161
View file @
2c22c7d9
...
@@ -462,12 +462,17 @@ class PersistenceTest(FeatureTest):
...
@@ -462,12 +462,17 @@ class PersistenceTest(FeatureTest):
DhtNetwork
.
log
(
"
Values didn
'
t reach new hosting nodes after shutdown.
"
)
DhtNetwork
.
log
(
"
Values didn
'
t reach new hosting nodes after shutdown.
"
)
def
run
(
self
):
def
run
(
self
):
try
:
if
self
.
_test
==
'
delete
'
:
if
self
.
_test
==
'
delete
'
:
self
.
_deleteTest
()
self
.
_deleteTest
()
elif
self
.
_test
==
'
replace
'
:
elif
self
.
_test
==
'
replace
'
:
self
.
_resplaceClusterTest
()
self
.
_resplaceClusterTest
()
elif
self
.
_test
==
'
mult_time
'
:
elif
self
.
_test
==
'
mult_time
'
:
self
.
_multTimeTest
()
self
.
_multTimeTest
()
except
Exception
as
e
:
print
(
e
)
finally
:
bootstrap
.
resize
(
1
)
#-----------
#-----------
#- Tests -
#- Tests -
...
@@ -487,7 +492,6 @@ class PersistenceTest(FeatureTest):
...
@@ -487,7 +492,6 @@ class PersistenceTest(FeatureTest):
ops_count
=
[]
ops_count
=
[]
try
:
bootstrap
.
resize
(
3
)
bootstrap
.
resize
(
3
)
consumer
=
bootstrap
.
get
(
1
)
consumer
=
bootstrap
.
get
(
1
)
producer
=
bootstrap
.
get
(
2
)
producer
=
bootstrap
.
get
(
2
)
...
@@ -547,11 +551,6 @@ class PersistenceTest(FeatureTest):
...
@@ -547,11 +551,6 @@ class PersistenceTest(FeatureTest):
else
:
else
:
DhtNetwork
.
log
(
"
[GET]: either couldn
'
t fetch values or nodes hosting values...
"
)
DhtNetwork
.
log
(
"
[GET]: either couldn
'
t fetch values or nodes hosting values...
"
)
except
Exception
as
e
:
print
(
e
)
finally
:
bootstrap
.
resize
(
1
)
def
_resplaceClusterTest
(
self
):
def
_resplaceClusterTest
(
self
):
"""
"""
It replaces all clusters one after the other.
It replaces all clusters one after the other.
...
@@ -565,7 +564,6 @@ class PersistenceTest(FeatureTest):
...
@@ -565,7 +564,6 @@ class PersistenceTest(FeatureTest):
bootstrap
=
self
.
bootstrap
bootstrap
=
self
.
bootstrap
try
:
bootstrap
.
resize
(
3
)
bootstrap
.
resize
(
3
)
consumer
=
bootstrap
.
get
(
1
)
consumer
=
bootstrap
.
get
(
1
)
producer
=
bootstrap
.
get
(
2
)
producer
=
bootstrap
.
get
(
2
)
...
@@ -592,11 +590,6 @@ class PersistenceTest(FeatureTest):
...
@@ -592,11 +590,6 @@ class PersistenceTest(FeatureTest):
self
.
_result
(
local_values
,
new_nodes
)
self
.
_result
(
local_values
,
new_nodes
)
except
Exception
as
e
:
print
(
e
)
finally
:
bootstrap
.
resize
(
1
)
def
_multTimeTest
(
self
):
def
_multTimeTest
(
self
):
"""
"""
Multiple put() calls are made from multiple nodes to multiple hashes
Multiple put() calls are made from multiple nodes to multiple hashes
...
@@ -642,7 +635,6 @@ class PersistenceTest(FeatureTest):
...
@@ -642,7 +635,6 @@ class PersistenceTest(FeatureTest):
str
(
self
.
bootstrap
.
port
))
str
(
self
.
bootstrap
.
port
))
flood_nodes
.
append
(
n
)
flood_nodes
.
append
(
n
)
try
:
bootstrap
.
resize
(
N_PRODUCERS
+
2
)
bootstrap
.
resize
(
N_PRODUCERS
+
2
)
consumer
=
bootstrap
.
get
(
1
)
consumer
=
bootstrap
.
get
(
1
)
producers
=
(
bootstrap
.
get
(
n
)
for
n
in
range
(
2
,
N_PRODUCERS
+
2
))
producers
=
(
bootstrap
.
get
(
n
)
for
n
in
range
(
2
,
N_PRODUCERS
+
2
))
...
@@ -679,11 +671,6 @@ class PersistenceTest(FeatureTest):
...
@@ -679,11 +671,6 @@ class PersistenceTest(FeatureTest):
gottaGetThemAllPokeNodes
(
nodes
=
nodes_after_time
)
gottaGetThemAllPokeNodes
(
nodes
=
nodes_after_time
)
self
.
_result
(
values
,
nodes_after_time
-
nodes
)
self
.
_result
(
values
,
nodes_after_time
-
nodes
)
except
Exception
as
e
:
print
(
e
)
finally
:
bootstrap
.
resize
(
1
)
class
PerformanceTest
(
FeatureTest
):
class
PerformanceTest
(
FeatureTest
):
"""
"""
Tests for general performance of dht operations.
Tests for general performance of dht operations.
...
@@ -701,10 +688,16 @@ class PerformanceTest(FeatureTest):
...
@@ -701,10 +688,16 @@ class PerformanceTest(FeatureTest):
super
(
PerformanceTest
,
self
).
__init__
(
test
,
workbench
)
super
(
PerformanceTest
,
self
).
__init__
(
test
,
workbench
)
def
run
(
self
):
def
run
(
self
):
try
:
if
self
.
_test
==
'
gets
'
:
if
self
.
_test
==
'
gets
'
:
self
.
_getsTimesTest
()
self
.
_getsTimesTest
()
elif
self
.
_test
==
'
delete
'
:
elif
self
.
_test
==
'
delete
'
:
self
.
_delete
()
self
.
_delete
()
except
Exception
as
e
:
print
(
e
)
finally
:
self
.
bootstrap
.
resize
(
1
)
###########
###########
# Tests #
# Tests #
...
@@ -806,7 +799,6 @@ class PerformanceTest(FeatureTest):
...
@@ -806,7 +799,6 @@ class PerformanceTest(FeatureTest):
bootstrap
=
self
.
bootstrap
bootstrap
=
self
.
bootstrap
try
:
bootstrap
.
resize
(
3
)
bootstrap
.
resize
(
3
)
consumer
=
bootstrap
.
get
(
1
)
consumer
=
bootstrap
.
get
(
1
)
producer
=
bootstrap
.
get
(
2
)
producer
=
bootstrap
.
get
(
2
)
...
@@ -842,11 +834,6 @@ class PerformanceTest(FeatureTest):
...
@@ -842,11 +834,6 @@ class PerformanceTest(FeatureTest):
FeatureTest
.
foreign_nodes
FeatureTest
.
foreign_nodes
)
)
except
Exception
as
e
:
print
(
e
)
finally
:
bootstrap
.
resize
(
1
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
parser
=
argparse
.
ArgumentParser
(
description
=
'
Run, test and benchmark a
'
\
parser
=
argparse
.
ArgumentParser
(
description
=
'
Run, test and benchmark a
'
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment