#!/usr/bin/env python
import argparse
from ml_board.backend.frontend_service.server import run_ml_board


def parse_args():
    parser = argparse.ArgumentParser(description='Websocket server')
    parser.add_argument('--ml_board_host', type=str, help='Specification of mlboard host', required=True)
    parser.add_argument('--ml_board_port', type=int, help='Specification of mlboard host', required=True)
    parser.add_argument('--rest_endpoint', type=str, help='Specification of REST endpoint (format: protocol://host:port)', required=True)
    parser.add_argument('--ws_endpoint', type=str, help='Specification of weboscket endpoint (format: protocol://host:port)', required=True)
    parser.add_argument('--run_id', type=str, help='Id of the run that is to be analyzed', required=True)
    args = parser.parse_args()
    ml_board_host = args.ml_board_host
    ml_board_port = args.ml_board_port
    rest_endpoint = args.rest_endpoint
    ws_endpoint = args.ws_endpoint
    run_id = args.run_id
    return ml_board_host, ml_board_port, rest_endpoint, ws_endpoint, run_id


ml_board_host, ml_board_port, rest_endpoint, ws_endpoint, run_id = parse_args()

run_ml_board(ml_board_host=ml_board_host, ml_board_port=ml_board_port, rest_endpoint=rest_endpoint, ws_endpoint=ws_endpoint, run_id=run_id)
