Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from concurrent.futures import ThreadPoolExecutor


def funcA(number):
k = 0
for i in range(number * 100):
Expand All @@ -9,6 +11,7 @@ def funcA(number):
# Use a generator expression directly in join for more efficiency
return " ".join(str(i) for i in range(number))


def test_threadpool() -> None:
pool = ThreadPoolExecutor(max_workers=3)
args = list(range(10, 31, 10))
Expand All @@ -19,4 +22,4 @@ def test_threadpool() -> None:


if __name__ == "__main__":
test_threadpool()
test_threadpool()
4 changes: 4 additions & 0 deletions codeflash/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,18 @@ def tracer_logic(self, frame: FrameType, event: str) -> None:
return
if self.timeout is not None and (time.time() - self.start_time) > self.timeout:
sys.setprofile(None)
threading.setprofile(None)
console.print(f"Codeflash: Timeout reached! Stopping tracing at {self.timeout} seconds.")
return
code = frame.f_code

file_name = Path(code.co_filename).resolve()
# TODO : It currently doesn't log the last return call from the first function

if code.co_name in self.ignored_functions:
return
if not file_name.is_relative_to(self.project_root):
return
if not file_name.exists():
return
if self.functions and code.co_name not in self.functions:
Expand Down
4 changes: 2 additions & 2 deletions tests/scripts/end_to_end_test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ def run_trace_test(cwd: pathlib.Path, config: TestConfig, expected_improvement_p
return False

functions_traced = re.search(r"Traced (\d+) function calls successfully and replay test created at - (.*)$", stdout)
if not functions_traced or int(functions_traced.group(1)) != 5:
logging.error("Expected 5 traced functions")
if not functions_traced or int(functions_traced.group(1)) != 4:
logging.error("Expected 4 traced functions")
return False

replay_test_path = pathlib.Path(functions_traced.group(2))
Expand Down
Loading