completely remove update_source_code (#3280)

This commit is contained in:
Xingyao Wang 2024-08-08 00:57:11 +08:00 committed by GitHub
parent 36ae44f6ef
commit b30a2dd87a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 2 additions and 133 deletions

View File

@ -65,7 +65,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=False,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -47,7 +47,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -65,7 +65,6 @@ def get_config(
container_image=BIOCODER_BENCH_CONTAINER_IMAGE,
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -78,7 +78,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -43,7 +43,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=False,
use_host_network=False,
update_source_code=True,
),
workspace_base=None,
workspace_mount_path=None,

View File

@ -54,7 +54,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -45,7 +45,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -68,7 +68,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -89,7 +89,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -52,7 +52,6 @@ def get_config(
container_image='xingyaoww/od-eval-logic-reasoning:v1.0',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
od_runtime_extra_deps='$OD_INTERPRETER_PATH -m pip install scitools-pyke',
),
# do not mount workspace

View File

@ -52,7 +52,6 @@ def get_config(
container_image='xingyaoww/od-eval-miniwob:v1.0',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
browsergym_eval_env=env_id,
),
# do not mount workspace

View File

@ -104,7 +104,6 @@ def get_config(
container_image='xingyaoww/od-eval-mint:v1.0',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
od_runtime_extra_deps=f'$OD_INTERPRETER_PATH -m pip install {" ".join(MINT_DEPENDENCIES)}',
),
# do not mount workspace

View File

@ -83,7 +83,6 @@ def get_config(
container_image='public.ecr.aws/i5g0m1f6/ml-bench',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -107,8 +107,6 @@ def get_config(
container_image=container_image,
enable_auto_lint=True,
use_host_network=False,
# always make sure we are using the latest source code
update_source_code=True,
# large enough timeout, since some testcases take very long to run
timeout=300,
),

View File

@ -48,7 +48,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
),
# do not mount workspace
workspace_base=None,

View File

@ -57,7 +57,6 @@ def get_config(
container_image='ubuntu:22.04',
enable_auto_lint=True,
use_host_network=False,
update_source_code=True,
browsergym_eval_env=env_id,
od_runtime_startup_env_vars={
'BASE_URL': base_url,

View File

@ -1,110 +0,0 @@
# OpenDevin Runtime
This README provides an overview of the OpenDevin Runtime, a crucial component of the OpenDevin system. It covers two main aspects:
1. How the Runtime Image is Built: Explains the layered approach to creating Docker images for both production and development environments.
2. How the Runtime Client Works: Details the functionality and architecture of the Runtime Client, which executes actions within the Docker sandbox.
The following sections dive deeper into these topics, providing a comprehensive understanding of the OpenDevin Runtime system.
## Architecture Diagram
```
+-------------------+ +-------------------+
| OpenDevin | | Docker Host |
| Backend | | |
| | | +-------------+ |
| +-------------+ | | | Runtime | |
| | EventStream | | | | Container | |
| | Runtime |<-|-----|->| | |
| +-------------+ | | | +-------+ | |
| | | | |Runtime| | |
| | | | |Client | | |
| | | | +-------+ | |
| | | | | | |
| | | | +-------+ | |
| | | | |Plugins| | |
| | | | +-------+ | |
| | | +-------------+ |
+-------------------+ +-------------------+
```
This diagram illustrates the high-level architecture of the OpenDevin Runtime system:
1. The OpenDevin Backend communicates with the Docker Host through the EventStreamRuntime.
2. The Docker Host runs a Runtime Container, which includes:
- The Runtime Client: Handles incoming actions and generates observations.
- Plugins: Extend the functionality of the Runtime Client.
3. The Runtime Client executes actions within the sandboxed environment of the Docker container.
This architecture ensures a secure and flexible environment for executing AI-driven development tasks, allowing OpenDevin to execute a wide range of actions safely and efficiently.
## How the Runtime Image is Built
The OpenDevin runtime uses a layered approach for building Docker images:
1. **Original Image**: `ubuntu:22.04`
- This is the base image used for all subsequent layers.
2. **Runtime Image**: `od_runtime:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04`
Example image name: `od_runtime:od_v0.8.1_image_ubuntu__22.04`
- Built from the stable release of OpenDevin.
- This is the primary runtime image that users will interact with.
- Created by copying all OpenDevin code into the original image and installing dependencies using Poetry.
1. **Dev Runtime Image**: `od_runtime_dev:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04`
- Built from local source code for development purposes.
### Build Process
#### Production Build (if environment variable `SANDBOX_UPDATE_SOURCE_CODE` is not set)
By default, when `SANDBOX_UPDATE_SOURCE_CODE` is unset OR set to false, the build process only needs to run once:
- The Runtime Image (`od_runtime:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04`) is created by copying OpenDevin code into the original Ubuntu image and installing all dependencies.
- This pre-built image is then used for running the OpenDevin environment.
#### Development Build (env var `SANDBOX_UPDATE_SOURCE_CODE=True`)
When developing or modifying code that runs inside the container, you can set env var `SANDBOX_UPDATE_SOURCE_CODE=True` to enable a more dynamic build process:
- Every time you run the code, the existing image will be updated with the latest changes.
- The Dev Runtime Image (`od_runtime_dev:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04`) is rebuilt from the Runtime Image (`od_runtime:od_v{OPENDEVIN_VERSION}_image_ubuntu__22.04`).
- Most dependencies are already installed in the Runtime Image, so this process mainly updates the code and any new dependencies.
- The rebuild process typically takes around 10 seconds, allowing for quick iterations during development.
This approach allows developers to easily test changes to the OpenDevin codebase, including modifications to files like client.py, without needing to rebuild the entire image from scratch each time.
## How the Runtime Client Works
The Runtime Client is a crucial component of the OpenDevin system, responsible for executing actions within the Docker sandbox environment and producing observations. Here's an overview of its functionality:
1. **Initialization**:
- The `EventStreamRuntime` class in `runtime.py` initializes the Docker container and sets up the runtime environment.
2. **Communication**:
- The Runtime Client uses FastAPI to create a web server inside the Docker container.
- It listens for incoming action requests from the OpenDevin backend.
3. **Action Execution**:
- When an action is received, the Runtime Client processes it based on its type:
- `CmdRunAction`: Executes shell commands using a pexpect-spawned bash shell.
- `FileReadAction` and `FileWriteAction`: Perform file operations within the sandbox.
- `IPythonRunCellAction`: Executes Python code in an IPython environment.
- `BrowseURLAction` and `BrowseInteractiveAction`: Handle web browsing tasks using a browser environment.
4. **Plugin System**:
- The Runtime Client supports a plugin system for extending functionality.
- Plugins like JupyterPlugin can be loaded to provide additional features.
5. **Observation Generation**:
- After executing an action, the Runtime Client generates an appropriate observation.
- Observations include command outputs, file contents, error messages, etc.
6. **Asynchronous Operation**:
- The Runtime Client uses asyncio for avoid concurrent requests.
- It ensures that only one action is executed at a time using a semaphore.
7. **Security**:
- All actions are executed within the confined Docker environment, providing a sandbox for safe execution.
8. **Flexibility**:
- The system supports both production (`SANDBOX_UPDATE_SOURCE_CODE=False`) and development (`SANDBOX_UPDATE_SOURCE_CODE=True`) modes.
- In development mode, the runtime image can be updated with the latest code changes for testing and debugging.

View File

@ -3,10 +3,6 @@ This is the main file for the runtime client.
It is responsible for executing actions received from OpenDevin backend and producing observations.
NOTE: this will be executed inside the docker sandbox.
If you already have pre-build docker image yet you changed the code in this file OR dependencies, you need to rebuild the docker image to update the source code.
You should add SANDBOX_UPDATE_SOURCE_CODE=True to any `python XXX.py` command you run to update the source code.
"""
import argparse

View File

@ -63,7 +63,7 @@ You can run:
# for server runtime
TEST_RUNTIME=server TEST_ONLY=true ./tests/integration/regenerate.sh
# for event stream
SANDBOX_UPDATE_SOURCE_CODE=True TEST_RUNTIME=eventstream TEST_ONLY=true ./tests/integration/regenerate.sh
TEST_RUNTIME=eventstream TEST_ONLY=true ./tests/integration/regenerate.sh
```
to run all integration tests until the first failure occurs.
@ -84,7 +84,7 @@ by running the following command from OpenDevin's project root directory:
```bash
TEST_RUNTIME=server ./tests/integration/regenerate.sh
SANDBOX_UPDATE_SOURCE_CODE=True TEST_RUNTIME=eventstream ./tests/integration/regenerate.sh
TEST_RUNTIME=eventstream ./tests/integration/regenerate.sh
```
Please note that this will: