fix
This commit is contained in:
parent
0b6dc3af1a
commit
5dbacec1b0
1
.gitignore
vendored
1
.gitignore
vendored
@ -121,3 +121,4 @@ GitHub.sublime-settings
|
|||||||
local_platform.json
|
local_platform.json
|
||||||
|
|
||||||
*pb2*
|
*pb2*
|
||||||
|
schemas
|
||||||
|
6
Makefile
6
Makefile
@ -1,2 +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:
|
||||||
|
python ./server.py
|
@ -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;
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
import time
|
import time
|
||||||
import tasks_pb2_grpc
|
from queues import tasks_pb2_grpc
|
||||||
import tasks_pb2
|
from queues import tasks_pb2
|
||||||
|
|
||||||
from google.protobuf import json_format
|
from google.protobuf import json_format
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user