Trajectron-plus-plus/trajpred/plumber.py

41 lines
1.2 KiB
Python
Raw Normal View History

import logging
2023-10-12 07:03:11 +00:00
from logging.handlers import SocketHandler
from multiprocessing import Process, Queue
from trajpred.config import parser
from trajpred.prediction_server import InferenceServer, run_inference_server
from trajpred.socket_forwarder import run_ws_forwarder
logger = logging.getLogger("trajpred.plumbing")
def start():
args = parser.parse_args()
loglevel = logging.NOTSET if args.verbose > 1 else logging.DEBUG if args.verbose > 0 else logging.INFO
logging.basicConfig(
level=loglevel,
)
2023-10-12 07:03:11 +00:00
if args.remote_log_addr:
logging.captureWarnings(True)
root_logger = logging.getLogger()
root_logger.setLevel(logging.NOTSET) # to send all records to cutelog
socket_handler = SocketHandler(args.remote_log_addr, args.remote_log_port)
root_logger.addHandler(socket_handler)
# instantiating process with arguments
procs = [
Process(target=run_ws_forwarder, args=(args,))
]
if not args.bypass_prediction:
procs.append(
2023-10-11 14:35:15 +00:00
Process(target=run_inference_server, args=(args,)),
)
logger.info("start")
for proc in procs:
proc.start()
for proc in procs:
proc.join()