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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
85600dbd
Commit
85600dbd
authored
Feb 23, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify code formatting state of partition table for logging
parent
3d83664e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
20 deletions
+8
-20
neo/lib/pt.py
neo/lib/pt.py
+8
-20
No files found.
neo/lib/pt.py
View file @
85600dbd
...
@@ -254,17 +254,11 @@ class PartitionTable(object):
...
@@ -254,17 +254,11 @@ class PartitionTable(object):
partition on the line (here, line length is 11 to keep the docstring
partition on the line (here, line length is 11 to keep the docstring
width under 80 column).
width under 80 column).
"""
"""
result
=
[]
node_list
=
sorted
(
self
.
count_dict
)
result
=
[
'pt: node %u: %s, %s'
%
(
i
,
dump
(
node
.
getUUID
()),
protocol
.
node_state_prefix_dict
[
node
.
getState
()])
for
i
,
node
in
enumerate
(
node_list
)]
append
=
result
.
append
append
=
result
.
append
node_list
=
self
.
count_dict
.
keys
()
node_list
=
[
k
for
k
,
v
in
self
.
count_dict
.
items
()
if
v
!=
0
]
node_list
.
sort
()
node_dict
=
{}
for
i
,
node
in
enumerate
(
node_list
):
uuid
=
node
.
getUUID
()
node_dict
[
uuid
]
=
i
append
(
'pt: node %d: %s, %s'
%
(
i
,
dump
(
uuid
),
protocol
.
node_state_prefix_dict
[
node
.
getState
()]))
line
=
[]
line
=
[]
max_line_len
=
20
# XXX: hardcoded number of partitions per line
max_line_len
=
20
# XXX: hardcoded number of partitions per line
cell_state_dict
=
protocol
.
cell_state_prefix_dict
cell_state_dict
=
protocol
.
cell_state_prefix_dict
...
@@ -278,16 +272,10 @@ class PartitionTable(object):
...
@@ -278,16 +272,10 @@ class PartitionTable(object):
if
row
is
None
:
if
row
is
None
:
line
.
append
(
'X'
*
len
(
node_list
))
line
.
append
(
'X'
*
len
(
node_list
))
else
:
else
:
cell
=
[]
cell_dict
=
dict
((
x
.
getNode
(),
cell_state_dict
[
x
.
getState
()])
cell_dict
=
dict
([(
node_dict
.
get
(
x
.
getUUID
(),
None
),
x
)
for
x
in
row
)
for
x
in
row
])
line
.
append
(
''
.
join
(
cell_dict
.
get
(
x
,
'.'
)
for
x
in
node_list
))
for
node
in
xrange
(
len
(
node_list
)):
if
line
:
if
node
in
cell_dict
:
cell
.
append
(
cell_state_dict
[
cell_dict
[
node
].
getState
()])
else
:
cell
.
append
(
'.'
)
line
.
append
(
''
.
join
(
cell
))
if
len
(
line
):
append
(
'pt: %0*u: %s'
%
(
prefix_len
,
prefix
,
'|'
.
join
(
line
)))
append
(
'pt: %0*u: %s'
%
(
prefix_len
,
prefix
,
'|'
.
join
(
line
)))
return
result
return
result
...
...
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