Skip to content

Commit

Permalink
chore: fix linting and poetry issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vvatelot committed Jan 15, 2025
1 parent f0da992 commit ca4b7d9
Show file tree
Hide file tree
Showing 8 changed files with 425 additions and 390 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Ecoindex python full stack dev container",
"image": "mcr.microsoft.com/devcontainers/python:3.12",
"postCreateCommand": "pipx install poetry && poetry self add poetry-multiproject-plugin && poetry self add poetry-polylith-plugin",
"postCreateCommand": "pipx install poetry==1.8.5 && poetry self add poetry-multiproject-plugin && poetry self add poetry-polylith-plugin",
"features": {
"ghcr.io/audacioustux/devcontainers/taskfile": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
Expand Down
3 changes: 0 additions & 3 deletions bases/ecoindex/backend/routers/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Annotated

import requests
import rich
from celery.result import AsyncResult
from ecoindex.backend.dependencies.validation import validate_api_key_batch
from ecoindex.backend.models.dependencies_parameters.id import IdParameter
Expand Down Expand Up @@ -159,12 +158,10 @@ async def add_ecoindex_analysis_task_batch(
],
batch_key: str = Depends(validate_api_key_batch),
):
rich.print(results)
task_result = ecoindex_batch_import_task.delay( # type: ignore
results=[result.model_dump() for result in results],
source=batch_key["source"], # type: ignore
)
rich.print(task_result)

return task_result.id

Expand Down
4 changes: 2 additions & 2 deletions bases/ecoindex/worker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


@app.task(
name="Make ecoindex analysis",
name="ecoindex.analysis",
bind=True,
autoretry_for=(Exception,),
retry_backoff=5,
Expand Down Expand Up @@ -159,7 +159,7 @@ async def async_ecoindex_task(


@app.task(
name="Batch import results in DB",
name="ecoindex.batch_import",
timezone=Settings().TZ,
queue="ecoindex_batch",
bind=True,
Expand Down
4 changes: 2 additions & 2 deletions projects/ecoindex_api/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ tasks:
deps: [start-redis]
internal: true
cmds:
- poetry run watchmedo auto-restart --directory=../.. --pattern=worker/*.py --recursive -- poetry run celery -- -A ecoindex.worker.tasks worker -l info -Q ecoindex -Q ecoindex_batch -E
- poetry run watchmedo auto-restart --directory=../.. --pattern=worker/*.py --recursive -- poetry run celery -- -A ecoindex.worker.tasks worker -l info -E
silent: true

start-backend:
Expand Down Expand Up @@ -217,7 +217,7 @@ tasks:
status:
- test -f docker-compose.yml

debug-queues:
monitor-queues:
desc: Show the queues of the docker-compose API
cmds:
- poetry run celery --app=ecoindex.worker.tasks events
6 changes: 3 additions & 3 deletions projects/ecoindex_api/docker/backend/dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM python:3-slim as requirements-stage
FROM python:3.12-slim AS requirements-stage

WORKDIR /tmp

RUN pip install poetry
RUN pip install poetry==1.8.5
COPY pyproject.toml poetry.lock /tmp/
RUN poetry export --with=backend --output=requirements.txt --without-hashes


FROM python:3-slim
FROM python:3.12-slim

ARG wheel=ecoindex_api-3.1.0-py3-none-any.whl

Expand Down
6 changes: 3 additions & 3 deletions projects/ecoindex_api/docker/worker/dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM python:3-slim as requirements-stage
FROM python:3.12-slim AS requirements-stage

WORKDIR /tmp

RUN pip install poetry
RUN pip install poetry==1.8.5
COPY pyproject.toml poetry.lock /tmp/
RUN poetry export --with=worker --output=requirements.txt --without-hashes


FROM python:3-slim
FROM python:3.12-slim

ARG wheel=ecoindex_api-3.1.0-py3-none-any.whl

Expand Down
2 changes: 1 addition & 1 deletion projects/ecoindex_api/docker/worker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

celery -A ecoindex.worker.tasks worker -Q ecoindex
celery -A ecoindex.worker.tasks worker
788 changes: 413 additions & 375 deletions projects/ecoindex_api/poetry.lock

Large diffs are not rendered by default.

0 comments on commit ca4b7d9

Please sign in to comment.