-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrpc_only.py
43 lines (29 loc) · 989 Bytes
/
grpc_only.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
import os
LOCAL_DIRECTORY = os.getcwd()
GRPC_DIR = os.path.join(LOCAL_DIRECTORY, "grpc")
sys.path.append(os.path.join(LOCAL_DIRECTORY, "networking"))
sys.path.append(GRPC_DIR)
import argparse
from localAgent import LocalAgent
from grpc_server import get_server
from agent_and_dnode import AgentDNodeHoster, Agent, DNode
from utilitary import create_node_id
from dataclasses import asdict
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--gport', type=str, required=True)
parser.add_argument('--join', type=str, required=False)
args = parser.parse_args()
argz = {
"join":args.join,
"gport":args.gport
}
LocalAgent.setMemData("args", argz)
LocalAgent.createCrons(args.gport)
print("going")
LocalAgent.launchCron("init")
print("server starting")
server = get_server("localhost:{}".format(args.gport))
server.start()
server.wait_for_termination()