Skip to content

Commit 530158c

Browse files
committed
ready to review
1 parent 6a4d842 commit 530158c

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

codeflash/api/aiservice.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -529,24 +529,20 @@ def get_optimization_impact(
529529
function_trace_id: str,
530530
coverage_message: str,
531531
replay_tests: str,
532-
concolic_tests: str,
533532
root_dir: Path,
534533
) -> str:
535-
"""Optimize the given python code for performance by making a request to the Django endpoint.
534+
"""Compute the optimization impact of current Pull Request.
536535
537536
Args:
538-
original_code: dict,
539-
new_code: dict,
540-
explanation: Explanation,
541-
existing_tests_source: str,
542-
generated_original_test_source: str,
543-
function_trace_id: str,
544-
coverage_message: str,
545-
replay_tests: str,
546-
concolic_tests: str,
547-
root_dir: Path,
548-
original_line_profiler_results: str,
549-
optimized_line_profiler_results: str,
537+
original_code: dict -> data structure mapping file paths to function definition for original code
538+
new_code: dict -> data structure mapping file paths to function definition for optimized code
539+
explanation: Explanation -> data structure containing runtime information
540+
existing_tests_source: str -> existing tests table
541+
generated_original_test_source: str -> annotated generated tests
542+
function_trace_id: str -> traceid of function
543+
coverage_message: str -> coverage information
544+
replay_tests: str -> replay test table
545+
root_dir: Path -> path of git directory
550546
551547
Returns:
552548
-------
@@ -574,7 +570,6 @@ def get_optimization_impact(
574570
"trace_id": function_trace_id,
575571
"coverage_message": coverage_message,
576572
"replay_tests": replay_tests,
577-
"concolic_tests": concolic_tests,
578573
"speedup": f"{100 + 100 * float(explanation.speedup):.2f}%",
579574
"loop_count": explanation.winning_benchmarking_test_results.number_of_loops(),
580575
"benchmark_details": explanation.benchmark_details if explanation.benchmark_details else None,

codeflash/optimization/function_optimizer.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,12 +1410,14 @@ def process_review(
14101410

14111411
if raise_pr or staging_review:
14121412
data["root_dir"] = git_root_dir()
1413-
# modify argument of staging vs pr based on the impact
1414-
opt_impact_response = self.aiservice_client.get_optimization_impact(**data)
1415-
if opt_impact_response == "low":
1416-
raise_pr = False
1417-
staging_review = True
1418-
1413+
try:
1414+
# modify argument of staging vs pr based on the impact
1415+
opt_impact_response = self.aiservice_client.get_optimization_impact(**data)
1416+
if opt_impact_response == "low":
1417+
raise_pr = False
1418+
staging_review = True
1419+
except Exception as e:
1420+
logger.debug(f"optimization impact response failed, investigate {e}")
14191421
if raise_pr and not staging_review:
14201422
data["git_remote"] = self.args.git_remote
14211423
check_create_pr(**data)

0 commit comments

Comments
 (0)