From 47e96174f9e4e9d775b1555d33c83147cfa31d13 Mon Sep 17 00:00:00 2001 From: jist <95856749+george0st@users.noreply.github.com> Date: Thu, 3 Oct 2024 21:09:59 +0200 Subject: [PATCH 1/3] varsion --- qgate_perf/version.py | 2 +- tests/test_core_evaluation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qgate_perf/version.py b/qgate_perf/version.py index a4399e5..271f680 100644 --- a/qgate_perf/version.py +++ b/qgate_perf/version.py @@ -1,3 +1,3 @@ # Store the version here so: -__version__ = '0.4.25' \ No newline at end of file +__version__ = '0.4.26' \ No newline at end of file diff --git a/tests/test_core_evaluation.py b/tests/test_core_evaluation.py index 22aa436..14f728a 100644 --- a/tests/test_core_evaluation.py +++ b/tests/test_core_evaluation.py @@ -43,7 +43,7 @@ def prf_calibration_onehundred_ms(run_setup: RunSetup) -> ParallelProbe: class TestCaseCoreEvaluation(unittest.TestCase): """ Test, if calculation of performance is correct - + IMPORTANT (main ideas) - all cases will have similar calls per second - the different duration time of tests does not change performance (calls per second) From 8d5e006e99c7dc331788c3e09c8deba5b220b140 Mon Sep 17 00:00:00 2001 From: jist <95856749+george0st@users.noreply.github.com> Date: Thu, 3 Oct 2024 21:36:12 +0200 Subject: [PATCH 2/3] Add return performance to the Run --- qgate_perf/parallel_executor.py | 15 +++++++++++++-- tests/test_core_evaluation.py | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/qgate_perf/parallel_executor.py b/qgate_perf/parallel_executor.py index e30d7ae..d98bd86 100644 --- a/qgate_perf/parallel_executor.py +++ b/qgate_perf/parallel_executor.py @@ -440,17 +440,19 @@ def run_executor(self, executor_list = ExecutorHelper.PROCESS_2_8_THREAD_1_4_SHO return final_state, performance return final_state - def run(self, processes=2, threads=2, run_setup: RunSetup=None) -> bool: + def run(self, processes = 2, threads = 2, run_setup: RunSetup = None, return_performance = False): """ Run execution of parallel call :param processes: how much processes will be used :param threads: how much threads will be used :param run_setup: setup of execution + :param return_performance: add to the return also performance, return will be state and performance (default is False) :return: return state, True - all executions was without exceptions, False - some exceptions """ file = None final_state=True + performance = [] print('Execution...') try: @@ -466,7 +468,13 @@ def run(self, processes=2, threads=2, run_setup: RunSetup=None) -> bool: with multiprocessing.Manager() as manager: return_dict = manager.dict() self._executeCore(run_setup, return_dict, processes, threads) - self._print_detail(file, run_setup, return_dict, processes, threads) + cals_sec = self._print_detail(file, run_setup, return_dict, processes, threads) + if return_performance: + performance.append(OutputPerformance(run_setup.bulk_row, + run_setup.bulk_col, + processes, + threads, + cals_sec)) if not self._final_state(return_dict): final_state = False @@ -478,6 +486,9 @@ def run(self, processes=2, threads=2, run_setup: RunSetup=None) -> bool: finally: if file is not None: file.close() + + if return_performance: + return final_state, performance return final_state def one_run(self, run_setup: RunSetup=None) -> bool: diff --git a/tests/test_core_evaluation.py b/tests/test_core_evaluation.py index 14f728a..ca8b5e4 100644 --- a/tests/test_core_evaluation.py +++ b/tests/test_core_evaluation.py @@ -53,7 +53,7 @@ class TestCaseCoreEvaluation(unittest.TestCase): @classmethod def setUpClass(cls): - shutil.rmtree(TestCaseCoreEvaluationCheck.OUTPUT_ADR, True) + shutil.rmtree(TestCaseCoreEvaluation.OUTPUT_ADR, True) @classmethod def tearDownClass(cls): From 8c8495f3508a18250e80231111419bdea853ade6 Mon Sep 17 00:00:00 2001 From: jist <95856749+george0st@users.noreply.github.com> Date: Thu, 3 Oct 2024 21:45:14 +0200 Subject: [PATCH 3/3] Update parallel_executor.py --- qgate_perf/parallel_executor.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/qgate_perf/parallel_executor.py b/qgate_perf/parallel_executor.py index d98bd86..ae5640f 100644 --- a/qgate_perf/parallel_executor.py +++ b/qgate_perf/parallel_executor.py @@ -491,28 +491,35 @@ def run(self, processes = 2, threads = 2, run_setup: RunSetup = None, return_per return final_state, performance return final_state - def one_run(self, run_setup: RunSetup=None) -> bool: - """ Run test, only one call, execution in new process, with standart write outputs + def one_run(self, run_setup: RunSetup = None, return_performance = False): + """ Run test, only one call, execution in new process, with standard write outputs :param run_setup: setting for run :param parameters: parameters for execution, application in case the run_setup is None + :param return_performance: add to the return also performance, return will be state and performance (default is False) :return: return state, True - all executions was without exceptions, False - some exceptions """ # setup minimalistic values if not run_setup: - run_setup = RunSetup(duration_second=0, start_delay=0) + run_setup = RunSetup(duration_second = 0, start_delay = 0) run_setup.set_bulk(1,1) # run - return self.run(processes=1, - threads=1, - run_setup=run_setup) + if return_performance: + state, perf = self.run(processes = 1, + threads = 1, + run_setup = run_setup, + return_performance = return_performance) + return state, perf + return self.run(processes = 1, + threads = 1, + run_setup = run_setup) def init_run(self, run_setup: RunSetup=None, print_output=False) -> bool: """ Init call in current process/thread (without ability to define parallel execution and without - write standard outputs to file). One new parametr was added '__INIT__': True + write standard outputs to file). One new parameter was added '__INIT__': True :param parameters: parameters for execution, application in case the run_setup is None :return: return state, True - execution was without exception,