Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
return default line profiler output when timeout happens
  • Loading branch information
aseembits93 committed Oct 28, 2025
commit 4a88798d2322feaee9dc923f3c33ea619355bb1e
7 changes: 7 additions & 0 deletions codeflash/optimization/function_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,13 @@ def line_profiler_step(
self.write_code_and_helpers(
self.function_to_optimize_source_code, original_helper_code, self.function_to_optimize.file_path
)
# this will happen when a timeoutexpired exception happens
if isinstance(line_profile_results, TestResults) and not line_profile_results.test_results:
logger.warning(
f"Timeout occured while running line profiler for original function {self.function_to_optimize.function_name}"
)
# set default value for line profiler results
return {"timings": {}, "unit": 0, "str_out": ""}
if line_profile_results["str_out"] == "":
logger.warning(
f"Couldn't run line profiler for original function {self.function_to_optimize.function_name}"
Expand Down
Loading