Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
uyegy
CPUnetPLOT
Commits
22874586
Commit
22874586
authored
Aug 21, 2014
by
Mario Hock
Browse files
Fix: allow non-matchable input
e.g. from only one host (or more than two)
parent
bcc75931
Changes
2
Hide whitespace changes
Inline
Side-by-side
cnlls.py
View file @
22874586
...
@@ -77,8 +77,7 @@ def show_summary(left_file, right_file=None):
...
@@ -77,8 +77,7 @@ def show_summary(left_file, right_file=None):
## BRANCH: No match -> fallback to show_brief()
## BRANCH: No match -> fallback to show_brief()
if
(
not
right_file
):
if
(
not
right_file
):
log
=
LogAnalyzer
(
left_file
)
log
=
LogAnalyzer
(
left_file
)
log
.
summarize
()
log
.
visualize_brief
()
log
.
show_brief
()
## BRANCH: Match -> Display both next to each other.
## BRANCH: Match -> Display both next to each other.
else
:
else
:
...
@@ -91,6 +90,7 @@ def show_summary(left_file, right_file=None):
...
@@ -91,6 +90,7 @@ def show_summary(left_file, right_file=None):
def
show
(
left_file
,
right_file
,
long
=
False
,
summary
=
False
):
def
show
(
left_file
,
right_file
,
long
=
False
,
summary
=
False
):
if
(
summary
):
if
(
summary
):
show_summary
(
left_file
,
right_file
)
show_summary
(
left_file
,
right_file
)
print
()
else
:
else
:
print_line
(
left_file
,
right_file
,
long
)
print_line
(
left_file
,
right_file
,
long
)
...
@@ -128,32 +128,30 @@ if __name__ == "__main__":
...
@@ -128,32 +128,30 @@ if __name__ == "__main__":
cnl_files
[
hostname
].
append
(
cnl_file
)
cnl_files
[
hostname
].
append
(
cnl_file
)
## Match.
hostnames
=
sorted
(
cnl_files
.
keys
()
)
hostnames
=
sorted
(
cnl_files
.
keys
()
)
left_files
=
cnl_files
[
hostnames
[
0
]]
right_files
=
cnl_files
[
hostnames
[
1
]]
for
left_file
in
left_files
:
## BRANCH: Input from two hosts -> Matching.
matching_file
=
find_match
(
left_file
,
right_files
)
if
(
len
(
hostnames
)
==
2
):
show
(
left_file
,
matching_file
,
args
.
long
,
args
.
summary
)
left_files
=
cnl_files
[
hostnames
[
0
]]
right_files
=
cnl_files
[
hostnames
[
1
]]
for
left_file
in
left_files
:
matching_file
=
find_match
(
left_file
,
right_files
)
show
(
left_file
,
matching_file
,
args
.
long
,
args
.
summary
)
## Print left over right files.
if
(
len
(
right_files
)
>
0
):
print
()
for
f
in
right_files
:
show
(
f
,
None
,
args
.
long
,
args
.
summary
)
## Print left over right files.
if
(
len
(
right_files
)
>
0
):
print
()
for
f
in
right_files
:
show
(
f
,
None
,
args
.
long
,
args
.
summary
)
## Print files with different hostnames
# Note: This is not the intended usecase!
if
(
len
(
hostnames
)
>
2
):
print
()
for
h
in
hostnames
[
2
:]:
## BRANCH: Only one (or more than two hosts) -> No matching.
else
:
for
h
in
hostnames
:
for
f
in
cnl_files
[
h
]:
for
f
in
cnl_files
[
h
]:
show
(
f
,
None
,
args
.
long
,
args
.
summary
)
show
(
f
,
None
,
args
.
long
,
args
.
summary
)
summary.py
View file @
22874586
...
@@ -54,7 +54,6 @@ def show_match(left_file, right_file):
...
@@ -54,7 +54,6 @@ def show_match(left_file, right_file):
# Note: The escape sequence for the "rate-bar" is counted as characters.. :-/
# Note: The escape sequence for the "rate-bar" is counted as characters.. :-/
print
()
print
()
print
()
...
...
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