diff --git a/codeflash/optimization/function_optimizer.py b/codeflash/optimization/function_optimizer.py index 1fc86a5a6..93def83c0 100644 --- a/codeflash/optimization/function_optimizer.py +++ b/codeflash/optimization/function_optimizer.py @@ -362,7 +362,7 @@ def determine_best_candidate( candidates = deque(candidates) # Start a new thread for AI service request, start loop in main thread # check if aiservice request is complete, when it is complete, append result to the candidates list - with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor: + with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor: future_line_profile_results = executor.submit( self.aiservice_client.optimize_python_code_line_profiler, source_code=code_context.read_writable_code, @@ -382,8 +382,8 @@ def determine_best_candidate( if done and (future_line_profile_results is not None): line_profile_results = future_line_profile_results.result() candidates.extend(line_profile_results) - original_len+= len(candidates) - logger.info(f"Added results from line profiler to candidates, total candidates now: {original_len}") + original_len+= len(line_profile_results) + logger.info(f"Added {len(line_profile_results)} results from line profiler to candidates, total candidates now: {original_len}") future_line_profile_results = None candidate_index += 1 candidate = candidates.popleft() @@ -1086,8 +1086,8 @@ def run_and_parse_tests( pytest_cmd=self.test_cfg.pytest_cmd, pytest_timeout=INDIVIDUAL_TESTCASE_TIMEOUT, pytest_target_runtime_seconds=testing_time, - pytest_min_loops=1, - pytest_max_loops=1, + pytest_min_loops=pytest_min_loops, + pytest_max_loops=pytest_min_loops, test_framework=self.test_cfg.test_framework, line_profiler_output_file=line_profiler_output_file, ) diff --git a/codeflash/verification/test_runner.py b/codeflash/verification/test_runner.py index fb53d8652..d8c58eb9a 100644 --- a/codeflash/verification/test_runner.py +++ b/codeflash/verification/test_runner.py @@ -182,8 +182,8 @@ def run_line_profile_tests( f"--timeout={pytest_timeout}", "-q", "--codeflash_loops_scope=session", - f"--codeflash_min_loops={pytest_min_loops}", - f"--codeflash_max_loops={pytest_max_loops}", + "--codeflash_min_loops=1", + "--codeflash_max_loops=1", f"--codeflash_seconds={pytest_target_runtime_seconds}", ] result_file_path = get_run_tmp_file(Path("pytest_results.xml"))