Skip to content

Commit

Permalink
scalability framework: refactorings: extract methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nrainer-materialize committed Dec 20, 2023
1 parent 6ceb50c commit 89cafdb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
29 changes: 23 additions & 6 deletions misc/python/materialize/scalability/comparison_outcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def has_significant_improvements(self) -> bool:
)
return len(self.significant_improvements) > 0

def has_scalability_changes(self) -> bool:
return self.has_regressions() or self.has_significant_improvements()

def __str__(self) -> str:
return f"{len(self.regressions)} regressions, {len(self.significant_improvements)} significant improvements"

Expand All @@ -60,17 +63,31 @@ def _to_description(self, entries: Sequence[ScalabilityChange]) -> str:
return "\n".join(f"* {x}" for x in entries)

def merge(self, other: ComparisonOutcome) -> None:
self.regressions.extend(other.regressions)
self.significant_improvements.extend(other.significant_improvements)
self.append_regression_df(other.regression_df)
self.append_significant_improvement_df(other.significant_improvement_df)
self.append_regressions(
other.regressions,
other.significant_improvements,
other.regression_df,
other.significant_improvement_df,
)

def append_regressions(
self,
regressions: list[Regression],
significant_improvements: list[ScalabilityImprovement],
regression_df: DfTotalsExtended,
significant_improvement_df: DfTotalsExtended,
) -> None:
self.regressions.extend(regressions)
self.significant_improvements.extend(significant_improvements)
self._append_regression_df(regression_df)
self._append_significant_improvement_df(significant_improvement_df)

def append_regression_df(self, regressions_data: DfTotalsExtended) -> None:
def _append_regression_df(self, regressions_data: DfTotalsExtended) -> None:
self.regression_df = concat_df_totals_extended(
[self.regression_df, regressions_data]
)

def append_significant_improvement_df(
def _append_significant_improvement_df(
self, significant_improvements_data: DfTotalsExtended
) -> None:
self.significant_improvement_df = concat_df_totals_extended(
Expand Down
10 changes: 5 additions & 5 deletions misc/python/materialize/scalability/result_analyzers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def perform_comparison_in_workload(
workload_name,
other_endpoint,
)
comparison_outcome.regressions.extend(regressions)
comparison_outcome.significant_improvements.extend(improvements)
comparison_outcome.append_regression_df(entries_worse_than_threshold)
comparison_outcome.append_significant_improvement_df(
entries_better_than_threshold
comparison_outcome.append_regressions(
regressions,
improvements,
entries_worse_than_threshold,
entries_better_than_threshold,
)
return comparison_outcome
2 changes: 1 addition & 1 deletion test/scalability/mzcompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def report_regression_result(

baseline_desc = endpoint_name_to_description(baseline_endpoint.try_load_version())

if outcome.has_regressions() or outcome.has_significant_improvements():
if outcome.has_scalability_changes():
print(
f"{'ERROR' if outcome.has_regressions() else 'INFO'}: "
f"The following scalability changes were detected "
Expand Down

0 comments on commit 89cafdb

Please sign in to comment.