Compare commits

..

No commits in common. "f4624772806ddfc8018180ea33bfa58f5eb6018c" and "8849a08930da4b44fca66f51b823a813a34abf6f" have entirely different histories.

5 changed files with 11 additions and 12 deletions

View File

@ -5,7 +5,7 @@ services:
queues:
image: mathwave/sprint-repo:queues
networks:
- queues-development
- queues
environment:
MONGO_HOST: "mongo.develop.sprinthub.ru"
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
@ -18,5 +18,7 @@ services:
order: start-first
networks:
queues-development:
common-infra-nginx:
external: true
queues:
external: true

View File

@ -5,6 +5,7 @@ services:
queues:
image: mathwave/sprint-repo:queues
networks:
- common-infra-nginx
- queues
environment:
MONGO_HOST: "mongo.sprinthub.ru"
@ -18,5 +19,7 @@ services:
order: start-first
networks:
common-infra-nginx:
external: true
queues:
external: true

View File

@ -28,7 +28,7 @@ jobs:
run: docker push mathwave/sprint-repo:queues
deploy-dev:
name: Deploy dev
runs-on: [prod]
runs-on: [dev]
needs: push
steps:
- name: login
@ -40,4 +40,4 @@ jobs:
- name: deploy
env:
MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }}
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml infra-development
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml infra

View File

@ -8,17 +8,10 @@ from app.storage.mongo import tasks
router = fastapi.APIRouter()
class Task(pydantic.BaseModel):
id: str
attempt: int
payload: dict
class Response(pydantic.BaseModel):
id: str
attempt: int
payload: dict
task: Task|None
@router.get('/api/v1/take', responses={404: {'description': 'Not found'}})
@ -26,4 +19,4 @@ async def execute(queue: typing.Annotated[str, fastapi.Header()]) -> Response:
task = await tasks.take_task(queue)
if not task:
raise fastapi.HTTPException(404)
return Response(id=str(task._id), attempt=task.attempts, payload=task.payload, task=Task(id=str(task._id), attempt=task.attempts, payload=task.payload))
return Response(id=str(task._id), attempt=task.attempts, payload=task.payload)

View File

@ -1,3 +1,4 @@
import asyncio
import bson
import datetime
import pydantic