Skip to content

Commit

Permalink
Merge pull request #80 from george0st/changes
Browse files Browse the repository at this point in the history
Bug fixing, add unit test
  • Loading branch information
george0st authored Oct 21, 2024
2 parents d4d44f1 + 5de54ee commit 3e905ea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
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.39'
__version__ = '0.4.40'
8 changes: 4 additions & 4 deletions tests/test_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from qgate_perf.parallel_executor import ParallelExecutor
from qgate_perf.parallel_probe import ParallelProbe
from qgate_perf.run_setup import RunSetup
from qgate_perf.helper import ExecutorHelper
from qgate_perf.helper import ExecutorHelper, get_readable_duration
from qgate_perf.run_return import RunReturn
from qgate_perf.standard_deviation import StandardDeviation
from pympler import asizeof
Expand Down Expand Up @@ -73,9 +73,9 @@ def test_size(self):
def test_readable_time(self):
exec = ParallelExecutor(None)

print(exec._readable_duration(100))
print(exec._readable_duration(100.45))
print(exec._readable_duration(5004.45))
print(get_readable_duration(100))
print(get_readable_duration(100.45))
print(get_readable_duration(5004.45))

def test_precison(self):
text_format="{:<05}"
Expand Down
24 changes: 24 additions & 0 deletions tests/test_perf_partly.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,27 @@ def test_basic2(self):

self.assertTrue(perf[1].executor_process == 4 and perf[1].executor_thread == 1)
self.assertTrue(perf[1][1].avrg < 1 and perf[1][0.9].avrg < 1)

def test_basic3(self):
generator = ParallelExecutor(prf_partly,
label="prf_partly",
detail_output=True,
output_file=path.join(self.OUTPUT_ADR, "perf_partly.txt"),
init_each_bulk=True)


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

self.assertTrue(perf.state)
self.assertTrue(perf[0].bundle_row == 1 and perf[0].bundle_col == 10)
self.assertTrue(perf[1].bundle_row == 1 and perf[1].bundle_col == 10)

self.assertTrue(perf[0].executor_process == 2 and perf[0].executor_thread == 1)
self.assertTrue(perf[0][1].avrg < 1 and perf[0][0.5].avrg < 1)

self.assertTrue(perf[1].executor_process == 4 and perf[1].executor_thread == 1)
self.assertTrue(perf[1][1].avrg < 1 and perf[1][0.5].avrg < 1)

0 comments on commit 3e905ea

Please sign in to comment.