Skip to content

Commit

Permalink
Merge pull request #85 from george0st/changes
Browse files Browse the repository at this point in the history
Tune unit tests and Results
  • Loading branch information
george0st authored Oct 25, 2024
2 parents 2f62e0a + 4998196 commit 96d5c49
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
13 changes: 8 additions & 5 deletions qgate_perf/output_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ def __len__(self):
return len(self._percentile_list)

def __str__(self):
# TODO: improve output
return (f"bundle ({self.bundle_row}x{self.bundle_col}), executor ({self.executor_process}x{self.executor_thread})"
f" = {self.percentiles[0].call_per_sec}")
info = f"bundle ({self.bundle_row}x{self.bundle_col}), executor ({self.executor_process}x{self.executor_thread}) = "
for percentile in self._percentile_list.keys():
info += f"{self._percentile_list[percentile].call_per_sec} [{int(percentile*100)}ph], "
return info[:-2]

class PerfResults(list):
"""Output from all performance tests"""
Expand Down Expand Up @@ -75,8 +76,10 @@ def __len__(self):
return len(self._results)

def __str__(self):
# TODO: improve output
pass
info = ""
for i in range(len(self._results)):
info += f"str(self._results[i])\n"
return info

class Output:

Expand Down
2 changes: 1 addition & 1 deletion qgate_perf/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Store the version here so:

__version__ = '0.4.44'
__version__ = '0.4.45'
28 changes: 27 additions & 1 deletion tests/test_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,35 @@ def test_run_percentiles_only_exceptions(self):
setup=RunSetup(duration_second=1, start_delay=0, parameters={"percentile": 0.95, "generate_error": "yes"})
generator.run_bulk_executor(bulk_list=[[1,10]],
executor_list=[[1,1], [2,1], [4,2]],
run_setup=setup).state
run_setup=setup)
self.assertTrue(len(generator.create_graph_perf(self.OUTPUT_ADR)) == 1)

def test_run_performance_detail(self):
generator = ParallelExecutor(prf_gil_impact,
label="GIL_impact",
detail_output=True,
output_file=path.join(self.OUTPUT_ADR, "perf_gil_impact_percentile.txt"),
init_each_bulk=True)


setup=RunSetup(duration_second=1, start_delay=0, parameters={"percentile": 0.95})
detail = generator.run_bulk_executor(bulk_list=[[1,10], [1,15]],
executor_list=[[1,1], [4,2]],
run_setup=setup,
performance_detail=True)

self.assertTrue(detail.state)
self.assertTrue(detail[0][1].call_per_sec > 0)
self.assertTrue(detail[1][1].call_per_sec > 0)
self.assertTrue(detail[2][1].call_per_sec > 0)
self.assertTrue(detail[3][1].call_per_sec > 0)
self.assertTrue(detail[0][0.95].call_per_sec > 0)
self.assertTrue(detail[1][0.95].call_per_sec > 0)
self.assertTrue(detail[2][0.95].call_per_sec > 0)
self.assertTrue(detail[3][0.95].call_per_sec > 0)
self.assertTrue(len(str(detail))>0)

print(str(detail))

# if __name__ == '__main__':
# unittest.main()

0 comments on commit 96d5c49

Please sign in to comment.