Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vincent Pelletier
neoppod
Commits
36fff189
Commit
36fff189
authored
Aug 13, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
master: remove dead code (pt.findLeastUsedNode)
parent
895d7801
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
39 deletions
+0
-39
neo/master/pt.py
neo/master/pt.py
+0
-11
neo/tests/master/testMasterPT.py
neo/tests/master/testMasterPT.py
+0
-28
No files found.
neo/master/pt.py
View file @
36fff189
...
...
@@ -87,17 +87,6 @@ class PartitionTable(neo.lib.pt.PartitionTable):
self
.
num_filled_rows
=
self
.
np
def
findLeastUsedNode
(
self
,
excluded_node_list
=
()):
min_count
=
self
.
np
+
1
min_node
=
None
for
node
,
count
in
self
.
count_dict
.
iteritems
():
if
min_count
>
count
\
and
node
not
in
excluded_node_list
\
and
node
.
isRunning
():
min_node
=
node
min_count
=
count
return
min_node
def
dropNodeList
(
self
,
node_list
,
simulate
=
False
):
partition_list
=
[]
change_list
=
[]
...
...
neo/tests/master/testMasterPT.py
View file @
36fff189
...
...
@@ -51,34 +51,6 @@ class MasterPartitionTableTests(NeoUnitTestBase):
self
.
assertFalse
(
pt
.
operational
())
self
.
assertFalse
(
pt
.
filled
())
def
test_11_findLeastUsedNode
(
self
):
num_partitions
=
5
num_replicas
=
2
pt
=
PartitionTable
(
num_partitions
,
num_replicas
)
# add nodes
uuid1
=
self
.
getStorageUUID
()
server1
=
(
"127.0.0.1"
,
19001
)
sn1
=
StorageNode
(
Mock
(),
server1
,
uuid1
,
NodeStates
.
RUNNING
)
pt
.
setCell
(
0
,
sn1
,
CellStates
.
UP_TO_DATE
)
pt
.
setCell
(
1
,
sn1
,
CellStates
.
UP_TO_DATE
)
pt
.
setCell
(
2
,
sn1
,
CellStates
.
UP_TO_DATE
)
uuid2
=
self
.
getStorageUUID
()
server2
=
(
"127.0.0.2"
,
19001
)
sn2
=
StorageNode
(
Mock
(),
server2
,
uuid2
,
NodeStates
.
RUNNING
)
pt
.
setCell
(
0
,
sn2
,
CellStates
.
UP_TO_DATE
)
pt
.
setCell
(
1
,
sn2
,
CellStates
.
UP_TO_DATE
)
uuid3
=
self
.
getStorageUUID
()
server3
=
(
"127.0.0.3"
,
19001
)
sn3
=
StorageNode
(
Mock
(),
server3
,
uuid3
,
NodeStates
.
RUNNING
)
pt
.
setCell
(
0
,
sn3
,
CellStates
.
UP_TO_DATE
)
# test
node
=
pt
.
findLeastUsedNode
()
self
.
assertEqual
(
node
,
sn3
)
node
=
pt
.
findLeastUsedNode
((
sn3
,
))
self
.
assertEqual
(
node
,
sn2
)
node
=
pt
.
findLeastUsedNode
((
sn3
,
sn2
))
self
.
assertEqual
(
node
,
sn1
)
def
test_13_outdate
(
self
):
# create nodes
uuid1
=
self
.
getStorageUUID
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment