Skip to content

Commit 7606c8e

Browse files
authored
Merge pull request #993 from codeflash-ai/don't-cleanup-replays
Don't cleanup replays and traces
2 parents 6054ca5 + 4873e0a commit 7606c8e

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

codeflash/optimization/optimizer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,16 @@ def cleanup_temporary_paths(self) -> None:
578578
get_run_tmp_file.tmpdir.cleanup()
579579
del get_run_tmp_file.tmpdir
580580

581+
# Always clean up concolic test directory
582+
cleanup_paths([self.test_cfg.concolic_test_root_dir])
583+
581584
if self.current_worktree:
582585
remove_worktree(self.current_worktree)
583586
return
584587

585588
if self.current_function_optimizer:
586589
self.current_function_optimizer.cleanup_generated_files()
587-
paths_to_cleanup = [self.test_cfg.concolic_test_root_dir, self.replay_tests_dir]
590+
paths_to_cleanup = [self.replay_tests_dir]
588591
if self.trace_file:
589592
paths_to_cleanup.append(self.trace_file)
590593
if self.test_cfg.tests_root.exists():

codeflash/picklepatch/pickle_patcher.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88

99
import contextlib
1010
import pickle
11+
import warnings
1112
from typing import Any, ClassVar
1213

1314
import dill
15+
from dill import PicklingWarning
1416

1517
from .pickle_placeholder import PicklePlaceholder
1618

19+
warnings.filterwarnings("ignore", category=PicklingWarning)
20+
1721

1822
class PicklePatcher:
1923
"""A utility class for safely pickling objects with unpicklable components.

codeflash/tracing/replay_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ def get_function_alias(module: str, function_name: str) -> str:
4444

4545

4646
def create_trace_replay_test(trace_file: str, functions: list[FunctionModules], max_run_count: int = 100) -> str:
47-
imports = """import dill as pickle
47+
imports = """import warnings
48+
import dill as pickle
49+
from dill import PicklingWarning
50+
warnings.filterwarnings("ignore", category=PicklingWarning)
4851
from codeflash.tracing.replay_test import get_next_arg_and_return
4952
"""
5053

codeflash/tracing/tracing_new_process.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import sys
1313
import threading
1414
import time
15+
import warnings
1516
from collections import defaultdict
1617
from importlib.util import find_spec
1718
from pathlib import Path
@@ -26,6 +27,10 @@
2627
from codeflash.picklepatch.pickle_patcher import PicklePatcher
2728
from codeflash.tracing.tracing_utils import FunctionModules, filter_files_optimized, module_name_from_file_path
2829

30+
# Suppress dill PicklingWarning
31+
warnings.filterwarnings("ignore", message="Cannot locate reference to")
32+
warnings.filterwarnings("ignore", message="Cannot pickle.*recursive self-references")
33+
2934
if TYPE_CHECKING:
3035
from types import FrameType, TracebackType
3136

codeflash/verification/codeflash_capture.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
import os
88
import sqlite3
99
import time
10+
import warnings
1011
from enum import Enum
1112
from pathlib import Path
1213
from typing import Callable
1314

1415
import dill as pickle
16+
from dill import PicklingWarning
17+
18+
warnings.filterwarnings("ignore", category=PicklingWarning)
1519

1620

1721
class VerificationType(str, Enum):

0 commit comments

Comments
 (0)