Skip to content

Commit

Permalink
add back cache dir and default to /tmp (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyaoww authored Apr 25, 2024
1 parent c45e2ae commit 88397e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions opendevin/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
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',
Expand Down Expand Up @@ -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)
5 changes: 5 additions & 0 deletions opendevin/sandbox/docker/ssh_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@ def restart_docker_container(self):
'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')
Expand Down

0 comments on commit 88397e0

Please sign in to comment.