add back cache dir and default to /tmp (#1359)

This commit is contained in:
Xingyao Wang
2024-04-25 22:46:15 +08:00
committed by GitHub
parent c45e2ae4d9
commit 88397e0469
2 changed files with 7 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ DEFAULT_CONFIG: dict = {
ConfigType.WORKSPACE_MOUNT_PATH: None,
ConfigType.WORKSPACE_MOUNT_PATH_IN_SANDBOX: '/workspace',
ConfigType.WORKSPACE_MOUNT_REWRITE: None,
ConfigType.CACHE_DIR: os.path.join(os.path.dirname(os.path.abspath(__file__)), '.cache'),
ConfigType.CACHE_DIR: '/tmp/cache', # '/tmp/cache' is the default cache directory
ConfigType.LLM_MODEL: 'gpt-3.5-turbo-1106',
ConfigType.SANDBOX_CONTAINER_IMAGE: DEFAULT_CONTAINER_IMAGE,
ConfigType.RUN_AS_DEVIN: 'true',
@@ -166,6 +166,6 @@ def get(key: str, required: bool = False):
return value
_cache_dir = config.get('CACHE_DIR')
_cache_dir = config.get(ConfigType.CACHE_DIR)
if _cache_dir:
pathlib.Path(_cache_dir).mkdir(parents=True, exist_ok=True)

View File

@@ -386,6 +386,11 @@ class DockerSSHBox(Sandbox):
'bind': SANDBOX_WORKSPACE_DIR,
'mode': 'rw'
},
# mount cache directory to /home/opendevin/.cache for pip cache reuse
config.get(ConfigType.CACHE_DIR): {
'bind': '/home/opendevin/.cache' if RUN_AS_DEVIN else '/root/.cache',
'mode': 'rw'
},
},
)
logger.info('Container started')