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

View File

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

View File

@ -28,7 +28,7 @@ jobs:
run: docker push mathwave/sprint-repo:queues run: docker push mathwave/sprint-repo:queues
deploy-dev: deploy-dev:
name: Deploy dev name: Deploy dev
runs-on: [prod] runs-on: [dev]
needs: push needs: push
steps: steps:
- name: login - name: login
@ -40,4 +40,4 @@ jobs:
- name: deploy - name: deploy
env: env:
MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }} 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() router = fastapi.APIRouter()
class Task(pydantic.BaseModel):
id: str
attempt: int
payload: dict
class Response(pydantic.BaseModel): class Response(pydantic.BaseModel):
id: str id: str
attempt: int attempt: int
payload: dict payload: dict
task: Task|None
@router.get('/api/v1/take', responses={404: {'description': 'Not found'}}) @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) task = await tasks.take_task(queue)
if not task: if not task:
raise fastapi.HTTPException(404) 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 bson
import datetime import datetime
import pydantic import pydantic