Skip to content

Commit

Permalink
move reporting related pv code within test harness to pv folder (#44)
Browse files Browse the repository at this point in the history
* move reporting related pv code to pv folder

* update fixtures and fix linting

* Delete test_harness/log_file_store/error_log_d8dce7ed-5684-4937-90b8-9558e8647422.txt

* remove commented out code from test harness conftest

* fix linting

* add debug print to check GitHub actions workflow

* update mock_start in test_send_events

* add mock_del
  • Loading branch information
AdrianMontaguSmartDCSIT authored May 28, 2024
1 parent 488cce2 commit be1968e
Show file tree
Hide file tree
Showing 14 changed files with 1,315 additions and 993 deletions.
4 changes: 3 additions & 1 deletion test_harness/protocol_verifier/pvperformanceresults.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
from prometheus_client.parser import text_fd_to_metric_families
from pygrok import Grok

from test_harness.reporting.log_analyser import yield_grok_metrics_from_files
from test_harness.protocol_verifier.reporting.log_analyser import (
yield_grok_metrics_from_files
)
from test_harness.results.aggregation import (
AggregationBin,
AggregationCount,
Expand Down
67 changes: 67 additions & 0 deletions test_harness/protocol_verifier/reporting/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
"""__init__ file. Contains methods to create and save report files"""

from pandas import DataFrame

from test_harness.protocol_verifier.reporting.log_analyser import (
logs_validity_df_to_results
)
from test_harness.protocol_verifier.reporting.report_results import (
get_report_files_mapping_from_dataframe_report,
)
from test_harness.reporting.report_delivery import deliver_test_report_files


def create_and_save_report_files(
log_string: str,
validity_df: DataFrame,
test_name: str,
output_directory_path: str,
) -> None:
"""Method to create report files from logs and validity dataframe and save
report files with a prefix in an output directory
:param log_string: String representing the log files
:type log_string: `str`
:param validity_df: :class:`DataFrame` holding the information on the test
files
:type validity_df: :class:`DataFrame`
:param test_name: The test name (or prefix) to give to the report files
:type test_name: `str`
:param output_directory_path: The path of the output directory to store
the results
:type output_directory_path: `str`
"""
report_files_mapping = create_report_files(
log_string=log_string, validity_df=validity_df, test_name=test_name
)
deliver_test_report_files(
report_files_mapping=report_files_mapping,
output_directory=output_directory_path,
)


def create_report_files(
log_string: str,
validity_df: DataFrame,
test_name: str,
event_id_job_id_map: dict[str, str] | None = None,
) -> dict[str, str | DataFrame]:
"""Method to create report files from logs and validity dataframe
:param log_string: String representing the log files
:type log_string: `str`
:param validity_df: :class:`DataFrame` holding the information on the test
files
:type validity_df: :class:`DataFrame`
:param test_name: The test name (or prefix) to give to the report files
:type test_name: `str`
"""
results_df = logs_validity_df_to_results(
log_string=log_string,
validity_df=validity_df,
event_id_job_id_map=event_id_job_id_map,
)
report_files_mapping = get_report_files_mapping_from_dataframe_report(
results_df=results_df, results_prefix=test_name
)
return report_files_mapping
File renamed without changes.
Loading

0 comments on commit be1968e

Please sign in to comment.