fix
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -118,4 +118,5 @@ GitHub.sublime-settings
 | 
			
		||||
!.vscode/extensions.json
 | 
			
		||||
.history
 | 
			
		||||
 | 
			
		||||
*pb2*
 | 
			
		||||
*pb2*
 | 
			
		||||
schemas
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,4 +1,6 @@
 | 
			
		||||
gen:
 | 
			
		||||
	python -m grpc_tools.protoc --proto_path schemas --python_out=. --pyi_out=. --grpc_python_out=. ./schemas/tasks.proto
 | 
			
		||||
	rm -rf schemas
 | 
			
		||||
	python generator.py queues
 | 
			
		||||
	python -m grpc_tools.protoc --proto_path schemas --python_out=. --pyi_out=. --grpc_python_out=. ./schemas/queues/tasks.proto
 | 
			
		||||
run:
 | 
			
		||||
	python ./server.py
 | 
			
		||||
							
								
								
									
										16
									
								
								generator.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								generator.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
import json
 | 
			
		||||
import urllib.request
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
arg = sys.argv[-1]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
response = urllib.request.urlopen(f'https://platform.sprinthub.ru/schemas/get?project={arg}').read()
 | 
			
		||||
data = json.loads(response)
 | 
			
		||||
os.mkdir('schemas')
 | 
			
		||||
os.mkdir(f'schemas/{arg}')
 | 
			
		||||
for key, value in data.items():
 | 
			
		||||
    with open(f'schemas/{arg}/{key}', 'w+') as fp:
 | 
			
		||||
        fp.write(value)
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user