Skip to content

Commit

Permalink
Merge pull request #71 from george0st/changes
Browse files Browse the repository at this point in the history
Remove invalid output file in case of all exceptions
  • Loading branch information
george0st authored Oct 13, 2024
2 parents 1520e8d + 14c07b8 commit 8ac2321
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
12 changes: 9 additions & 3 deletions qgate_perf/parallel_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,15 @@ def _create_percentile_list(self, run_setup: RunSetup, return_dict) -> dict[Perc
else:
if percentile_list.get(result.percentile, None) is None:
percentile_list[result.percentile] = PercentileSummary(result.percentile, 0, 0, 0, 0, 0, 0)
else:
if percentile_list.get(1, None) is None:
percentile_list[1] = PercentileSummary(1,0,0, 0, 0,0,0)

# if 100 percentile does not exist, create it
if percentile_list.get(1, None) is None:
percentile_list[1] = PercentileSummary(1,0,0, 0, 0,0,0)

# if expected percentile does not exist, create it
if run_setup.exist("percentile"):
if percentile_list.get(run_setup["percentile"], None) is None:
percentile_list[run_setup["percentile"]] = PercentileSummary(run_setup["percentile"],0,0, 0, 0,0,0)

# final calculation
for percentile in percentile_list.values():
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.34'
__version__ = '0.4.35'
15 changes: 15 additions & 0 deletions tests/test_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,20 @@ def test_run_percentiles2(self):
executor_list=[[4,2]],
run_setup=setup))

def test_run_percentiles_only_exceptions(self):
"""Simulate percentile support with bundle execution and all exceptions"""
generator = ParallelExecutor(prf_gil_impact,
label="percentiles_only_exception",
detail_output=True,
output_file=path.join(self.OUTPUT_ADR, "perf_percentiles_only_exception.txt"),
init_each_bulk=True)

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)
self.assertTrue(len(generator.create_graph_perf(self.OUTPUT_ADR)) == 1)


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

0 comments on commit 8ac2321

Please sign in to comment.