Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions codeflash/api/cfapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def suggest_changes(
coverage_message: str,
replay_tests: str = "",
concolic_tests: str = "",
optimization_impact: str = "",
) -> Response:
"""Suggest changes to a pull request.

Expand All @@ -155,6 +156,7 @@ def suggest_changes(
"coverage_message": coverage_message,
"replayTests": replay_tests,
"concolicTests": concolic_tests,
"optimization_impact": optimization_impact,
}
return make_cfapi_request(endpoint="/suggest-pr-changes", method="POST", payload=payload)

Expand All @@ -171,6 +173,7 @@ def create_pr(
coverage_message: str,
replay_tests: str = "",
concolic_tests: str = "",
optimization_impact: str = "",
) -> Response:
"""Create a pull request, targeting the specified branch. (usually 'main').

Expand All @@ -195,6 +198,7 @@ def create_pr(
"coverage_message": coverage_message,
"replayTests": replay_tests,
"concolicTests": concolic_tests,
"optimization_impact": optimization_impact,
}
return make_cfapi_request(endpoint="/create-pr", method="POST", payload=payload)

Expand All @@ -210,6 +214,7 @@ def create_staging(
replay_tests: str,
concolic_tests: str,
root_dir: Path,
optimization_impact: str = "",
) -> Response:
"""Create a staging pull request, targeting the specified branch. (usually 'staging').

Expand Down Expand Up @@ -250,6 +255,7 @@ def create_staging(
"coverage_message": coverage_message,
"replayTests": replay_tests,
"concolicTests": concolic_tests,
"optimization_impact": optimization_impact,
}

return make_cfapi_request(endpoint="/create-staging", method="POST", payload=payload)
Expand Down
14 changes: 6 additions & 8 deletions codeflash/optimization/function_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,14 +1461,12 @@ def process_review(

if raise_pr or staging_review:
data["root_dir"] = git_root_dir()
# try:
# # modify argument of staging vs pr based on the impact
# opt_impact_response = self.aiservice_client.get_optimization_impact(**data)
# if opt_impact_response == "low":
# raise_pr = False
# staging_review = True
# except Exception as e:
# logger.debug(f"optimization impact response failed, investigate {e}")
opt_impact_response = ""
try:
opt_impact_response = self.aiservice_client.get_optimization_impact(**data)
except Exception as e:
logger.debug(f"optimization impact response failed, investigate {e}")
data["optimization_impact"] = opt_impact_response
if raise_pr and not staging_review:
data["git_remote"] = self.args.git_remote
check_create_pr(**data)
Expand Down
3 changes: 3 additions & 0 deletions codeflash/result/create_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def check_create_pr(
concolic_tests: str,
root_dir: Path,
git_remote: Optional[str] = None,
optimization_impact: str = "",
) -> None:
pr_number: Optional[int] = env_utils.get_pr_number()
git_repo = git.Repo(search_parent_directories=True)
Expand Down Expand Up @@ -226,6 +227,7 @@ def check_create_pr(
coverage_message=coverage_message,
replay_tests=replay_tests,
concolic_tests=concolic_tests,
optimization_impact=optimization_impact,
)
if response.ok:
logger.info(f"Suggestions were successfully made to PR #{pr_number}")
Expand Down Expand Up @@ -275,6 +277,7 @@ def check_create_pr(
coverage_message=coverage_message,
replay_tests=replay_tests,
concolic_tests=concolic_tests,
optimization_impact=optimization_impact,
)
if response.ok:
pr_id = response.text
Expand Down
Loading