Skip to content

Commit e970866

Browse files
committed
let's not clean up traces and rpelays
1 parent e2f4324 commit e970866

2 files changed

Lines changed: 1 addition & 34 deletions

File tree

codeflash/optimization/optimizer.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,6 @@ def run(self) -> None:
409409
if self.args.worktree:
410410
self.worktree_mode()
411411

412-
if not self.args.replay_test and self.test_cfg.tests_root.exists():
413-
leftover_trace_files = list(self.test_cfg.tests_root.glob("*.trace"))
414-
if leftover_trace_files:
415-
logger.debug(f"Cleaning up {len(leftover_trace_files)} leftover trace file(s) from previous runs")
416-
cleanup_paths(leftover_trace_files)
417-
418412
cleanup_paths(Optimizer.find_leftover_instrumented_test_files(self.test_cfg.tests_root))
419413

420414
function_optimizer = None
@@ -525,8 +519,6 @@ def run(self) -> None:
525519
)
526520
if self.functions_checkpoint:
527521
self.functions_checkpoint.cleanup()
528-
if hasattr(self.args, "command") and self.args.command == "optimize":
529-
self.cleanup_replay_tests()
530522
if optimizations_found == 0:
531523
logger.info("❌ No optimizations found.")
532524
elif self.args.all:
@@ -562,17 +554,6 @@ def find_leftover_instrumented_test_files(test_root: Path) -> list[Path]:
562554
file_path for file_path in test_root.rglob("*") if file_path.is_file() and pattern.match(file_path.name)
563555
]
564556

565-
def cleanup_replay_tests(self) -> None:
566-
paths_to_cleanup = []
567-
if self.replay_tests_dir and self.replay_tests_dir.exists():
568-
logger.debug(f"Cleaning up replay tests directory: {self.replay_tests_dir}")
569-
paths_to_cleanup.append(self.replay_tests_dir)
570-
if self.trace_file and self.trace_file.exists():
571-
logger.debug(f"Cleaning up trace file: {self.trace_file}")
572-
paths_to_cleanup.append(self.trace_file)
573-
if paths_to_cleanup:
574-
cleanup_paths(paths_to_cleanup)
575-
576557
def cleanup_temporary_paths(self) -> None:
577558
if hasattr(get_run_tmp_file, "tmpdir"):
578559
get_run_tmp_file.tmpdir.cleanup()
@@ -584,14 +565,7 @@ def cleanup_temporary_paths(self) -> None:
584565

585566
if self.current_function_optimizer:
586567
self.current_function_optimizer.cleanup_generated_files()
587-
paths_to_cleanup = [self.test_cfg.concolic_test_root_dir, self.replay_tests_dir]
588-
if self.trace_file:
589-
paths_to_cleanup.append(self.trace_file)
590-
if self.test_cfg.tests_root.exists():
591-
for trace_file in self.test_cfg.tests_root.glob("*.trace"):
592-
if trace_file not in paths_to_cleanup:
593-
paths_to_cleanup.append(trace_file)
594-
cleanup_paths(paths_to_cleanup)
568+
cleanup_paths([self.test_cfg.concolic_test_root_dir])
595569

596570
def worktree_mode(self) -> None:
597571
if self.current_worktree:

codeflash/tracer.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def main(args: Namespace | None = None) -> ArgumentParser:
8686
# to the output file at startup.
8787
if parsed_args.outfile is not None:
8888
parsed_args.outfile = Path(parsed_args.outfile).resolve()
89-
outfile = parsed_args.outfile
9089
config, found_config_path = parse_config_file(parsed_args.codeflash_config)
9190
project_root = project_root_from_module_root(Path(config["module_root"]), found_config_path)
9291
if len(unknown_args) > 0:
@@ -216,12 +215,6 @@ def main(args: Namespace | None = None) -> ArgumentParser:
216215

217216
optimizer.run_with_args(args)
218217

219-
# Delete the trace file and the replay test file if they exist
220-
if outfile:
221-
outfile.unlink(missing_ok=True)
222-
for replay_test_path in replay_test_paths:
223-
Path(replay_test_path).unlink(missing_ok=True)
224-
225218
except BrokenPipeError as exc:
226219
# Prevent "Exception ignored" during interpreter shutdown.
227220
sys.stdout = None

0 commit comments

Comments
 (0)