Skip to content

Commit 76b3358

Browse files
refactor: save artifact to problem dir after search is finished
1 parent e648c11 commit 76b3358

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

MaxKernel/auto_search/run_search.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ async def run_search(
110110
with open(reference_file, "r") as f:
111111
reference_code = f.read()
112112

113+
run_subdir = None
113114
if not graph_db_path:
114115
timestamp = time.strftime("%Y%m%d_%H%M%S")
115116
run_subdir = os.path.join(
@@ -144,6 +145,14 @@ async def run_search(
144145
await orchestrator.run()
145146

146147
best_result = save_optimized_kernel(orchestrator, problem_dir, algorithm)
148+
149+
if run_subdir:
150+
import shutil
151+
152+
dest_dir = os.path.join(problem_dir, os.path.basename(run_subdir))
153+
shutil.copytree(run_subdir, dest_dir, dirs_exist_ok=True)
154+
logger.info(f"Copied artifacts to {dest_dir}")
155+
147156
if best_result:
148157
best_id, latency = best_result
149158
return problem_id, f"Success (Best: {best_id}, Latency: {latency} ms)"

0 commit comments

Comments
 (0)