diff --git a/rdagent/core/experiment.py b/rdagent/core/experiment.py index 937ee70f..680e712e 100644 --- a/rdagent/core/experiment.py +++ b/rdagent/core/experiment.py @@ -133,8 +133,8 @@ class FBWorkspace(Workspace): Helper function to format the code dictionary into a string. """ code_string = "" - for file_name, code in code_dict.items(): - code_string += f"\nFile Path: {file_name}\n```\n{code}\n```" + for file_name in sorted(code_dict.keys()): + code_string += f"\nFile Path: {file_name}\n```\n{code_dict[file_name]}\n```" return code_string @property diff --git a/rdagent/utils/env.py b/rdagent/utils/env.py index a919ce37..b885096a 100644 --- a/rdagent/utils/env.py +++ b/rdagent/utils/env.py @@ -11,6 +11,7 @@ import json import os import pickle import re +import shutil import subprocess import time import uuid @@ -416,6 +417,7 @@ class DockerEnv(Env[DockerConf]): """ Unzip a file into a folder, use zipfile instead of subprocess """ + shutil.rmtree(folder_path, ignore_errors=True) with zipfile.ZipFile(zip_file_path, "r") as z: z.extractall(folder_path)