Exemplo n.º 1
0
def launch():
    parser = argparse.ArgumentParser(description='Launch psiTurk dashboard.')
    parser.add_argument('-i',
                        '--ip',
                        default='localhost',
                        help='IP to run dashboard on. default is `localhost`.')
    parser.add_argument('-p',
                        '--port',
                        default=22361,
                        help='Port to run dashboard on. default is 22361.')
    args = parser.parse_args()
    dashboard_ip = args.ip
    dashboard_port = args.port
    dashboard_route = 'dashboard'

    browser_launch_thread = control.launch_browser_when_online(
        dashboard_ip, dashboard_port, dashboard_route)
    if not control.is_port_available(ip=dashboard_ip, port=dashboard_port):
        print "Server is already running on http://{host}:{port}/{route}".format(
            host=dashboard_ip, port=dashboard_port, route=dashboard_route)
    else:
        port = config.getint('Server Parameters', 'port')
        print "Serving on ", "http://" + dashboard_ip + ":" + str(
            dashboard_port)
        app.run(debug=True,
                use_reloader=False,
                port=dashboard_port,
                host=dashboard_ip)
Exemplo n.º 2
0
def is_port_available_route():
    """
    Check if port is available on localhost
    """
    if request.method == 'POST':
        test_port = request.json['port']
        if test_port == config.getint('Server Parameters', 'port'):
            is_available = 1
        else:
            is_available = control.is_port_available(ip='127.0.0.1', port=test_port)
        return jsonify(is_available=is_available)
    return "port check"
Exemplo n.º 3
0
def is_port_available_route():
    """
    Check if port is available on localhost
    """
    if request.method == 'POST':
        test_port = request.json['port']
        if test_port == config.getint('Server Parameters', 'port'):
            is_available = 1
        else:
            is_available = control.is_port_available(ip='127.0.0.1',
                                                     port=test_port)
        return jsonify(is_available=is_available)
    return "port check"
Exemplo n.º 4
0
def launch():
    parser = argparse.ArgumentParser(description='Launch psiTurk dashboard.')
    parser.add_argument('-i', '--ip', default='localhost',
                        help='IP to run dashboard on. default is `localhost`.')
    parser.add_argument('-p', '--port', default=22361,
                        help='Port to run dashboard on. default is 22361.')
    args = parser.parse_args()
    dashboard_ip = args.ip
    dashboard_port = args.port
    dashboard_route = 'dashboard'
    
    browser_launch_thread = control.launch_browser_when_online(dashboard_ip, dashboard_port, dashboard_route)
    if not control.is_port_available(ip=dashboard_ip, port=dashboard_port):
        print "Server is already running on http://{host}:{port}/{route}".format(host=dashboard_ip, port=dashboard_port, route=dashboard_route)
    else:
        port = config.getint('Server Parameters', 'port')
        print "Serving on ", "http://" +  dashboard_ip + ":" + str(dashboard_port)
        app.run(debug=True, use_reloader=False, port=dashboard_port, host=dashboard_ip)