-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue: 4176956: move the text handling to the analyzers classes #284
Conversation
plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/base_analyzer.py
Outdated
Show resolved
Hide resolved
plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/events_log_analyzer.py
Outdated
Show resolved
Hide resolved
plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/base_analyzer.py
Outdated
Show resolved
Hide resolved
plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/link_flapping_analyzer.py
Outdated
Show resolved
Hide resolved
plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/ufm_top_analyzer.py
Outdated
Show resolved
Hide resolved
plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/console_log_analyzer.py
Show resolved
Hide resolved
...ns/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/ibdiagnet2_port_counters_analyzer.py
Outdated
Show resolved
Hide resolved
...ns/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/ibdiagnet2_port_counters_analyzer.py
Outdated
Show resolved
Hide resolved
...ns/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/ibdiagnet2_port_counters_analyzer.py
Outdated
Show resolved
Hide resolved
...ns/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/ibdiagnet2_port_counters_analyzer.py
Outdated
Show resolved
Hide resolved
@@ -85,7 +86,7 @@ def add_list_of_dicts_as_text(self, data_list, title=None, headers=None): | |||
|
|||
def add_dataframe_as_text(self, data_frame, title=None): | |||
"""Adds a DataFrame to the PDF as aligned text without row numbers.""" | |||
if data_frame is None or data_frame.empty: | |||
if not isinstance(data_frame, pd.DataFrame) or data_frame.empty: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about None?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if data_frame is None, 'isinstance(data_frame, pd.DataFrame)' will return False
plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/base_analyzer.py
Show resolved
Hide resolved
plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/events_log_analyzer.py
Outdated
Show resolved
Hide resolved
@@ -193,3 +193,34 @@ def get_number_of_core_dumps(self): | |||
self._log_data_sorted["type"] == "timeout_dump_core" | |||
] | |||
return {"Amount": len(core_dumps)} | |||
|
|||
def full_analysis(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Miryam,
You misunderstood the purpose of the assignment. The base class already created an infrastructure to run the analysis. You should add methods to run as part of the base class full_analysis and NOT implement your own full_analysis method.
If it not clear let talk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I changed it
@@ -33,4 +33,5 @@ def full_analysis(self): | |||
Returns a list of all the graphs created and their title | |||
""" | |||
self.print_fabric_size() | |||
return [] | |||
fabric_info = self.get_fabric_size() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing. Use the infrastructure in the base class to run this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -142,5 +142,7 @@ def plot_link_flapping_last_week(self): | |||
) | |||
|
|||
def full_analysis(self): | |||
self.get_link_flapping_last_week() | |||
return super().full_analysis() | |||
super().full_analysis() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing. Use the infrastructure in the base class to run this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
) as infile, open( | ||
temp_file, "w", newline="", encoding=DataConstants.UTF8ENCODING | ||
) as outfile: | ||
with ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this display
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ruff requires this display
plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzers/base_analyzer.py
Show resolved
Hide resolved
c669d09
to
ba0a836
Compare
What
Move text and dataframes handling from main to the analyzers classes.
Why ?
https://redmine.mellanox.com/issues/4176956
For the sake of code aesthetics, readability, and encapsulation.
How ?
Some sub-classes of BaseAnalyzer class, override the implementation of analysis method, to add their own logic (handle text and dataframes).
Testing ?
Tested manually with various inputs to ensure the output file remains consistent.
Special triggers
Use the following phrases as comments to trigger different runs
bot:retest
rerun Jenkins CI (to rerun GitHub CI, use "Checks" tab on PR page and rerun all jobs)bot:upgrade
run additional update tests