39 lines
1,002 B
Python
39 lines
1,002 B
Python
|
import logging
|
||
|
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,
|
||
|
)
|
||
|
# rootLogger = logging.getLogger()
|
||
|
# rootLogger.setLevel(loglevel)
|
||
|
|
||
|
movement_q = Queue()
|
||
|
prediction_q = Queue()
|
||
|
|
||
|
|
||
|
# instantiating process with arguments
|
||
|
procs = [
|
||
|
Process(target=run_ws_forwarder, args=(args,))
|
||
|
]
|
||
|
if not args.bypass_prediction:
|
||
|
procs.append(
|
||
|
Process(target=run_inference_server, args=(args, movement_q, prediction_q)),
|
||
|
)
|
||
|
|
||
|
logger.info("start")
|
||
|
for proc in procs:
|
||
|
proc.start()
|
||
|
|
||
|
for proc in procs:
|
||
|
proc.join()
|
||
|
|