Skip to content

Commit

Permalink
Merge branch 'main' into Fix/-avoid-passing-redundant-values-to-evalu…
Browse files Browse the repository at this point in the history
…ation-payload
  • Loading branch information
bekossy committed Jan 23, 2024
2 parents 8223ef7 + b0cb158 commit 6397e30
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 42 deletions.
10 changes: 4 additions & 6 deletions agenta-backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ FROM python:3.9-slim-buster

WORKDIR /app

# Install git and clone the necessary repository
RUN apt-get update -y \
&& apt-get install -y git

# Ensure pip and poetry are up to date
RUN pip install --upgrade pip \
&& pip install poetry
Expand All @@ -18,12 +22,6 @@ RUN touch /app/agenta_backend/__init__.py
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi

# Install git and clone the necessary repository
RUN apt-get update -y \
&& apt-get install -y git \
&& git clone https://github.com/mmabrouk/beanie \
&& cd beanie && pip install .

# remove dummy module
RUN rm -r /app/agenta_backend
EXPOSE 8000
2 changes: 1 addition & 1 deletion agenta-backend/agenta_backend/tasks/evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def evaluate(
# 2. Initialize vars
evaluators_aggregated_data = {
str(evaluator_config_db.id): {
"evaluator_key": evaluator_config.evaluator_key,
"evaluator_key": evaluator_config_db.evaluator_key,
"results": [],
}
for evaluator_config_db in evaluator_config_dbs
Expand Down
15 changes: 10 additions & 5 deletions agenta-backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion agenta-backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sentry-sdk = {extras = ["fastapi"], version = "^1.34.0"}
kubernetes = "^28.1.0"
celery = "^5.3.6"
watchdog = {extras = ["watchmedo"], version = "^3.0.0"}
beanie = "^1.24.0"
beanie = {git = "https://github.com/mmabrouk/beanie"}

[tool.poetry.group.dev.dependencies]
pytest = "^7.3.1"
Expand Down
32 changes: 3 additions & 29 deletions docs/self-host/migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,16 @@ To upgrade to the latest version of Agenta, execute the following command:

```
docker compose -f docker-compose.gh.yml up -d --pull always
```

This command instructs Docker to fetch and use the latest version of the Agenta image.

## Database Migration with Beanie

This guide offers detailed steps for performing database migrations in the Agenta backend system, using Beanie, a MongoDB ODM (Object Document Mapper) for Python. You can learn more about Beanie [here](https://github.com/roman-right/beanie).

### Setting Up Beanie

To install a custom version of Beanie:

```
git clone <https://github.com/mmabrouk/beanie>
cd beanie
pip install .
```

### Migrating from Version 0.7 to 0.8

1. **Accessing the Migration Directory**: First, navigate to the migration directory:
1. **Executing the Beanie Migration**: Run the migration script as follows:

```
cd agenta_backend/migrations/17_01_24_pydantic_and_evaluations
```

2. **Executing the Beanie Migration**: Run the migration script as follows:

docker compose exec -w /app/agenta_backend/migrations/17_01_24_pydantic_and_evaluations/ agenta-backend bash -c 'beanie migrate --no-use-transaction -uri $MONGODB_URI -db 'agenta_v2' -p .'
```
beanie migrate --no-use-transaction -uri 'mongodb://username:password@localhost' -db 'agenta_v2' -p .
```

<Warning>
Make sure to replace `username`, `password`, and other relevant placeholders with your actual credentials, unless you're using default settings.
</Warning>

0 comments on commit 6397e30

Please sign in to comment.