Compare commits
15 Commits
73ba329510
...
prod
| Author | SHA1 | Date | |
|---|---|---|---|
| cdde0698dc | |||
| d519bed7b0 | |||
| 7b96aa6315 | |||
| b51b87d202 | |||
| 0228bd03fe | |||
| ebb1a17ac0 | |||
| cd23f8ba13 | |||
| 4d5a4d44bd | |||
| 06ca5f5f3c | |||
| 8ea015e277 | |||
| 7c2fb7cd6e | |||
| 2fbac213c7 | |||
| 8eda61e56b | |||
| 4c3f6d3d5c | |||
| a8ae799a8e |
@@ -2,8 +2,8 @@ version: "3.4"
|
|||||||
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
queues:
|
queues-grpc:
|
||||||
image: mathwave/sprint-repo:queues-py3-grpc
|
image: mathwave/sprint-repo:queues-grpc
|
||||||
networks:
|
networks:
|
||||||
- queues-development
|
- queues-development
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ version: "3.4"
|
|||||||
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
queues:
|
queues-grpc:
|
||||||
image: mathwave/sprint-repo:queues-py3-grpc
|
image: mathwave/sprint-repo:queues-grpc
|
||||||
networks:
|
networks:
|
||||||
- queues
|
- queues
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: dev
|
ref: dev
|
||||||
- name: build
|
- name: build
|
||||||
run: docker build -t mathwave/sprint-repo:queues-py3-grpc .
|
run: docker build -t mathwave/sprint-repo:queues-grpc .
|
||||||
push:
|
push:
|
||||||
name: Push
|
name: Push
|
||||||
runs-on: [ dev ]
|
runs-on: [ dev ]
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
- name: push
|
- name: push
|
||||||
run: docker push mathwave/sprint-repo:queues-py3-grpc
|
run: docker push mathwave/sprint-repo:queues-grpc
|
||||||
deploy-dev:
|
deploy-dev:
|
||||||
name: Deploy dev
|
name: Deploy dev
|
||||||
runs-on: [prod]
|
runs-on: [prod]
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: prod
|
ref: prod
|
||||||
- name: build
|
- name: build
|
||||||
run: docker build -t mathwave/sprint-repo:queues-py3-grpc .
|
run: docker build -t mathwave/sprint-repo:queues-grpc .
|
||||||
push:
|
push:
|
||||||
name: Push
|
name: Push
|
||||||
runs-on: [ dev ]
|
runs-on: [ dev ]
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
- name: push
|
- name: push
|
||||||
run: docker push mathwave/sprint-repo:queues-py3-grpc
|
run: docker push mathwave/sprint-repo:queues-grpc
|
||||||
deploy-prod:
|
deploy-prod:
|
||||||
name: Deploy prod
|
name: Deploy prod
|
||||||
runs-on: [prod]
|
runs-on: [prod]
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -119,3 +119,4 @@ GitHub.sublime-settings
|
|||||||
.history
|
.history
|
||||||
|
|
||||||
*pb2*
|
*pb2*
|
||||||
|
schemas
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -1,4 +1,6 @@
|
|||||||
gen:
|
gen:
|
||||||
python -m grpc_tools.protoc --proto_path schemas --python_out=. --pyi_out=. --grpc_python_out=. ./schemas/tasks.proto
|
curl https://platform.sprinthub.ru/generator >> generator.py
|
||||||
|
python generator.py
|
||||||
|
rm generator.py
|
||||||
run:
|
run:
|
||||||
python ./server.py
|
python ./server.py
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
annotated-types==0.7.0
|
annotated-types==0.7.0
|
||||||
bson==0.5.10
|
certifi==2024.8.30
|
||||||
|
charset-normalizer==3.4.0
|
||||||
dnspython==2.7.0
|
dnspython==2.7.0
|
||||||
grpcio==1.68.1
|
grpcio==1.68.1
|
||||||
grpcio-tools==1.68.1
|
grpcio-tools==1.68.1
|
||||||
|
idna==3.10
|
||||||
motor==3.6.0
|
motor==3.6.0
|
||||||
protobuf==5.29.1
|
protobuf==5.29.1
|
||||||
pydantic==2.10.3
|
pydantic==2.10.3
|
||||||
pydantic_core==2.27.1
|
pydantic_core==2.27.1
|
||||||
pymongo==4.9.2
|
pymongo==4.9
|
||||||
python-dateutil==2.9.0.post0
|
python-dateutil==2.9.0.post0
|
||||||
|
requests==2.32.3
|
||||||
setuptools==75.6.0
|
setuptools==75.6.0
|
||||||
six==1.17.0
|
six==1.17.0
|
||||||
typing_extensions==4.12.2
|
typing_extensions==4.12.2
|
||||||
|
urllib3==2.2.3
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package queues;
|
|
||||||
|
|
||||||
import "google/protobuf/struct.proto";
|
|
||||||
|
|
||||||
service Tasks {
|
|
||||||
rpc Put (PutRequest) returns (EmptyResponse) {}
|
|
||||||
|
|
||||||
rpc Take (TakeRequest) returns (TakeResponse) {}
|
|
||||||
|
|
||||||
rpc Finish (FinishRequest) returns (EmptyResponse) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
message Task {
|
|
||||||
string id = 1;
|
|
||||||
int64 attempt = 2;
|
|
||||||
google.protobuf.Struct payload = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PutRequest {
|
|
||||||
string queue = 1;
|
|
||||||
int64 seconds_to_execute = 2;
|
|
||||||
optional int64 delay = 3;
|
|
||||||
google.protobuf.Struct payload = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TakeRequest {
|
|
||||||
string queue = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message FinishRequest {
|
|
||||||
string id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message EmptyResponse {}
|
|
||||||
|
|
||||||
message TakeResponse {
|
|
||||||
optional Task task = 1;
|
|
||||||
}
|
|
||||||
@@ -3,8 +3,8 @@ import datetime
|
|||||||
import grpc
|
import grpc
|
||||||
import bson
|
import bson
|
||||||
|
|
||||||
import tasks_pb2
|
from queues import tasks_pb2
|
||||||
import tasks_pb2_grpc
|
from queues import tasks_pb2_grpc
|
||||||
|
|
||||||
from utils import time
|
from utils import time
|
||||||
from storage.mongo import tasks
|
from storage.mongo import tasks
|
||||||
|
|||||||
Reference in New Issue
Block a user