grpc will now always be ran, but can be configured through command line or core.conf
This commit is contained in:
parent
c5ce85b235
commit
e298a2a5c1
2 changed files with 8 additions and 11 deletions
|
@ -4,7 +4,7 @@ url = "https://pypi.org/simple"
|
||||||
verify_ssl = true
|
verify_ssl = true
|
||||||
|
|
||||||
[scripts]
|
[scripts]
|
||||||
core = "python scripts/core-daemon -f data/core.conf -l data/logging.conf --grpc"
|
core = "python scripts/core-daemon -f data/core.conf -l data/logging.conf"
|
||||||
test = "pytest -v tests"
|
test = "pytest -v tests"
|
||||||
test_emane = "pytest -v tests/emane"
|
test_emane = "pytest -v tests/emane"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ from core.api.grpc.server import CoreGrpcServer
|
||||||
from core.api.tlv.corehandlers import CoreHandler, CoreUdpHandler
|
from core.api.tlv.corehandlers import CoreHandler, CoreUdpHandler
|
||||||
from core.api.tlv.coreserver import CoreServer, CoreUdpServer
|
from core.api.tlv.coreserver import CoreServer, CoreUdpServer
|
||||||
from core.constants import CORE_CONF_DIR, COREDPY_VERSION
|
from core.constants import CORE_CONF_DIR, COREDPY_VERSION
|
||||||
from core.emulator import enumerations
|
|
||||||
from core.emulator.enumerations import CORE_API_PORT
|
from core.emulator.enumerations import CORE_API_PORT
|
||||||
from core.utils import close_onexec, load_logging_config
|
from core.utils import close_onexec, load_logging_config
|
||||||
|
|
||||||
|
@ -67,14 +66,13 @@ def cored(cfg):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# initialize grpc api
|
# initialize grpc api
|
||||||
if cfg["grpc"] == "True":
|
grpc_server = CoreGrpcServer(server.coreemu)
|
||||||
grpc_server = CoreGrpcServer(server.coreemu)
|
address_config = cfg["grpcaddress"]
|
||||||
address_config = cfg["grpcaddress"]
|
port_config = cfg["grpcport"]
|
||||||
port_config = cfg["grpcport"]
|
grpc_address = f"{address_config}:{port_config}"
|
||||||
grpc_address = f"{address_config}:{port_config}"
|
grpc_thread = threading.Thread(target=grpc_server.listen, args=(grpc_address,))
|
||||||
grpc_thread = threading.Thread(target=grpc_server.listen, args=(grpc_address,))
|
grpc_thread.daemon = True
|
||||||
grpc_thread.daemon = True
|
grpc_thread.start()
|
||||||
grpc_thread.start()
|
|
||||||
|
|
||||||
# start udp server
|
# start udp server
|
||||||
start_udp(server, address)
|
start_udp(server, address)
|
||||||
|
@ -117,7 +115,6 @@ def get_merged_config(filename):
|
||||||
parser.add_argument("-n", "--numthreads", dest="numthreads", type=int,
|
parser.add_argument("-n", "--numthreads", dest="numthreads", type=int,
|
||||||
help=f"number of server threads; default = {default_threads}")
|
help=f"number of server threads; default = {default_threads}")
|
||||||
parser.add_argument("--ovs", action="store_true", help="enable experimental ovs mode, default is false")
|
parser.add_argument("--ovs", action="store_true", help="enable experimental ovs mode, default is false")
|
||||||
parser.add_argument("--grpc", action="store_true", help="enable grpc api, default is false")
|
|
||||||
parser.add_argument("--grpc-port", dest="grpcport",
|
parser.add_argument("--grpc-port", dest="grpcport",
|
||||||
help=f"grpc port to listen on; default {default_grpc_port}")
|
help=f"grpc port to listen on; default {default_grpc_port}")
|
||||||
parser.add_argument("--grpc-address", dest="grpcaddress",
|
parser.add_argument("--grpc-address", dest="grpcaddress",
|
||||||
|
|
Loading…
Add table
Reference in a new issue