示例#1
0
            (r'/api/v1/outputs/(.*)', OutputFileHandler),
            (r'/api/v1/errors/(.*)', ErrorFileHandler),
        ],
        cookie_secret=str(uuid.uuid4()),
        login_url='/auth/login',
        template_path=os.path.join(os.path.dirname(__file__), 'templates'),
        static_path=os.path.join(os.path.dirname(__file__), 'static'),
        xsrf_cookies=True,
        debug=False,
        google_redirect_url=options.redirect_url,
        google_oauth={'key': options.client_id, 'secret': options.client_secret},
        compiled_template_cache=False,
    )

    application.listen(
        port=options.port,
        max_buffer_size=40*1024,
    )

    signal.signal(signal.SIGUSR1, lambda x, y: judge.halt_judging())

    logger.info("Setup complete, starting IOLoop")
    try:
        ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        logger.info("Server halted by ^C, shutting down judger")
    except Exception as e:
        logger.critical("Server crashed: %s" % e.message)
    finally:
        judge.halt_judging()
示例#2
0
        ],
        cookie_secret=str(uuid.uuid4()),
        login_url='/auth/login',
        template_path=os.path.join(os.path.dirname(__file__), 'templates'),
        static_path=os.path.join(os.path.dirname(__file__), 'static'),
        xsrf_cookies=True,
        debug=False,
        google_redirect_url=options.redirect_url,
        google_oauth={
            'key': options.client_id,
            'secret': options.client_secret
        },
    )

    application.listen(
        port=options.port,
        max_buffer_size=40 * 1024,
    )

    signal.signal(signal.SIGUSR1, lambda x, y: judge.halt_judging())

    logger.info("Setup complete, starting IOLoop")
    try:
        ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        logger.info("Server halted by ^C, shutting down judger")
    except Exception as e:
        logger.critical("Server crashed: %s" % e.message)
    finally:
        judge.halt_judging()