determinism

This commit is contained in:
Kevin Turcios 2025-04-03 22:28:57 -05:00
parent 17de10ba89
commit 080be20753
2 changed files with 8 additions and 1 deletions

View file

@ -1,4 +1,6 @@
from concurrent.futures import ThreadPoolExecutor
def funcA(number):
k = 0
for i in range(number * 100):
@ -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))
@ -19,4 +22,4 @@ def test_threadpool() -> None:
if __name__ == "__main__":
test_threadpool()
test_threadpool()

View file

@ -247,14 +247,18 @@ class Tracer:
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: