Merge pull request 'master' (#17) from master into prod
Reviewed-on: #17
This commit is contained in:
commit
f462477280
@ -5,7 +5,7 @@ services:
|
||||
queues:
|
||||
image: mathwave/sprint-repo:queues
|
||||
networks:
|
||||
- queues
|
||||
- queues-development
|
||||
environment:
|
||||
MONGO_HOST: "mongo.develop.sprinthub.ru"
|
||||
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
||||
@ -18,7 +18,5 @@ services:
|
||||
order: start-first
|
||||
|
||||
networks:
|
||||
common-infra-nginx:
|
||||
external: true
|
||||
queues:
|
||||
queues-development:
|
||||
external: true
|
||||
|
@ -5,7 +5,6 @@ services:
|
||||
queues:
|
||||
image: mathwave/sprint-repo:queues
|
||||
networks:
|
||||
- common-infra-nginx
|
||||
- queues
|
||||
environment:
|
||||
MONGO_HOST: "mongo.sprinthub.ru"
|
||||
@ -19,7 +18,5 @@ services:
|
||||
order: start-first
|
||||
|
||||
networks:
|
||||
common-infra-nginx:
|
||||
external: true
|
||||
queues:
|
||||
external: true
|
||||
|
@ -28,7 +28,7 @@ jobs:
|
||||
run: docker push mathwave/sprint-repo:queues
|
||||
deploy-dev:
|
||||
name: Deploy dev
|
||||
runs-on: [dev]
|
||||
runs-on: [prod]
|
||||
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
|
||||
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml infra-development
|
||||
|
@ -8,10 +8,17 @@ 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'}})
|
||||
@ -19,4 +26,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)
|
||||
return Response(id=str(task._id), attempt=task.attempts, payload=task.payload, task=Task(id=str(task._id), attempt=task.attempts, payload=task.payload))
|
||||
|
@ -1,4 +1,3 @@
|
||||
import asyncio
|
||||
import bson
|
||||
import datetime
|
||||
import pydantic
|
||||
|
Loading…
Reference in New Issue
Block a user