Exemple #1
0
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    server_common.add_common_args(parser)
    parser.add_argument(
        '--tcp-port',
        default=9990,
        type=int,
        help='The port the TCP server should listen on.',
    )
    parser.add_argument(
        'min_angle',
        type=int,
    )
    parser.add_argument(
        'max_angle',
        type=int,
    )
    parser.add_argument(
        'model_length',
        type=int,
    )
    args = parser.parse_args()

    tcp_server = TCPListener(io_loop=ioloop.IOLoop.current(),
                             model_length=args.model_length)
    tcp_server.listen(args.tcp_port, address='localhost')

    ws_args = (LoopingWebSocket, )

    server_common.main(args, ws_args, 'tcp', args.min_angle, args.max_angle,
                       args.model_length)
Exemple #2
0
        """)
    parser.add_argument(
        '--pool-path',
        default=b'',
        type=lambda s: (s if type(s) == bytes else s.encode()),
        help="""The full path to the desired "pool" variable to visualise.  If
        unset, it is assumed that a doasvm_mon instance (named "doasvm_mon")
        exists in the same namespace as the pooling plug-in specified by
        --pooling-id, and that it has has a variable named "pool".
        """)
    args = parser.parse_args()

    # abort the connection after a 5 second timeout
    with MHAConnection(args.mha_host, args.mha_port, 5) as mha_conn:
        plugin_path = mha_conn.find_id(args.classification_id)
        if not plugin_path:
            classification_id = args.classification_id.decode()
            exit('Error: Could not find plug-in with ID "' +
                 classification_id + '"')
        angles = mha_conn.get_val_converted(plugin_path[0] + b'.angles')

    ws_args = (LoopingWebSocket, {
        'mha_host': args.mha_host,
        'mha_port': args.mha_port,
        'pooling_id': args.pooling_id,
        'pool_path': args.pool_path
    })

    server_common.main(args, ws_args, 'mha', min(angles), max(angles),
                       len(angles))