示例#1
0
def run():
    if HAIL_SHOULD_PROFILE:
        profiler_tag = f'{DEFAULT_NAMESPACE}'
        if profiler_tag == 'default':
            profiler_tag = DEFAULT_NAMESPACE + f'-{HAIL_SHA[0:12]}'
        googlecloudprofiler.start(
            service='batch-driver',
            service_version=profiler_tag,
            # https://cloud.google.com/profiler/docs/profiling-python#agent_logging
            verbose=3)

    app = web.Application(client_max_size=HTTP_CLIENT_MAX_SIZE)
    setup_aiohttp_session(app)

    setup_aiohttp_jinja2(app, 'batch.driver')
    setup_common_static_routes(routes)
    app.add_routes(routes)
    app.router.add_get("/metrics", server_stats)

    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)

    web.run_app(deploy_config.prefix_application(
        app, 'batch-driver', client_max_size=HTTP_CLIENT_MAX_SIZE),
                host='0.0.0.0',
                port=5000,
                access_log_class=AccessLogger,
                ssl_context=get_server_ssl_context())
示例#2
0
def run(local_mode):
    app = web.Application()

    if local_mode:
        log.error('running in local mode with bogus cookie storage key')
        aiohttp_session.setup(
            app,
            aiohttp_session.cookie_storage.EncryptedCookieStorage(
                b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                cookie_name=deploy_config.auth_session_cookie_name(),
                secure=True,
                httponly=True,
                domain=os.environ['HAIL_DOMAIN'],
                # 2592000s = 30d
                max_age=2592000,
            ),
        )
    else:
        setup_aiohttp_session(app)

    setup_aiohttp_jinja2(app, 'website',
                         jinja2.PackageLoader('website', 'pages'),
                         jinja2.PackageLoader('website', 'docs'))
    setup_common_static_routes(routes)
    app.add_routes(routes)
    app.router.add_get("/metrics", server_stats)
    sass_compile('website')
    web.run_app(
        deploy_config.prefix_application(app, 'www'),
        host='0.0.0.0',
        port=5000,
        access_log_class=AccessLogger,
        ssl_context=None if local_mode else internal_server_ssl_context(),
    )
示例#3
0
def init_app() -> web.Application:
    app = web.Application()
    setup_aiohttp_jinja2(app, 'benchmark')
    setup_aiohttp_session(app)

    setup_common_static_routes(router)
    app.add_routes(router)
    return app
示例#4
0
def run():
    app = web.Application()
    setup_aiohttp_jinja2(app, 'ci')
    setup_aiohttp_session(app)

    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)

    setup_common_static_routes(routes)
    app.add_routes(routes)

    web.run_app(deploy_config.prefix_application(app, 'ci'), host='0.0.0.0', port=5000)
示例#5
0
def init_app(routes):
    app = web.Application()
    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)
    setup_aiohttp_jinja2(app, 'notebook')
    setup_aiohttp_session(app)

    root = os.path.dirname(os.path.abspath(__file__))
    routes.static('/static', f'{root}/static')
    setup_common_static_routes(routes)
    app.add_routes(routes)

    return app
示例#6
0
def init_app(routes):
    app = web.Application(middlewares=[monitor_endpoints_middleware])
    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)
    setup_aiohttp_jinja2(app, 'notebook')
    setup_aiohttp_session(app)

    root = os.path.dirname(os.path.abspath(__file__))
    routes.static('/static', f'{root}/static')
    setup_common_static_routes(routes)
    app.add_routes(routes)
    app.router.add_get("/metrics", server_stats)

    return app
示例#7
0
def run():
    app = web.Application(client_max_size=None)
    setup_aiohttp_session(app)

    setup_aiohttp_jinja2(app, 'batch.front_end')
    setup_common_static_routes(routes)
    app.add_routes(routes)
    app.router.add_get("/metrics", server_stats)

    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)

    web.run_app(deploy_config.prefix_application(app, 'batch2'),
                host='0.0.0.0',
                port=5000)
示例#8
0
def run():
    app = web.Application()
    setup_aiohttp_jinja2(app, 'benchmark')
    setup_aiohttp_session(app)

    setup_common_static_routes(router)
    router.static('/static', f'{BENCHMARK_ROOT}/static')
    app.add_routes(router)
    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)
    web.run_app(deploy_config.prefix_application(app, 'benchmark'),
                host='0.0.0.0',
                port=5000,
                access_log_class=AccessLogger,
                ssl_context=internal_server_ssl_context())
示例#9
0
def run():
    app = web.Application()
    app.on_startup.append(on_startup)

    setup_aiohttp_jinja2(app, 'scorecard')
    setup_aiohttp_session(app)

    setup_common_static_routes(routes)

    app.add_routes(routes)

    web.run_app(deploy_config.prefix_application(app, 'scorecard'),
                host='0.0.0.0',
                port=5000,
                access_log_class=AccessLogger)
示例#10
0
def run():
    app = web.Application()
    setup_aiohttp_session(app)

    setup_aiohttp_jinja2(app, 'address')
    setup_common_static_routes(routes)
    app.add_routes(routes)

    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)

    web.run_app(deploy_config.prefix_application(app, 'address'),
                host='0.0.0.0',
                port=5000,
                access_log_class=AccessLogger,
                ssl_context=get_in_cluster_server_ssl_context())
示例#11
0
文件: main.py 项目: nawatts/hail
def run():
    app = web.Application(client_max_size=HTTP_CLIENT_MAX_SIZE)
    setup_aiohttp_session(app)

    setup_aiohttp_jinja2(app, 'batch.driver')
    setup_common_static_routes(routes)
    app.add_routes(routes)
    app.router.add_get("/metrics", server_stats)

    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)

    web.run_app(deploy_config.prefix_application(app,
                                                 'batch-driver',
                                                 client_max_size=HTTP_CLIENT_MAX_SIZE),
                host='0.0.0.0',
                port=5000)
示例#12
0
def run():
    app = web.Application(middlewares=[monitor_endpoints_middleware])
    setup_aiohttp_jinja2(app, 'ci')
    setup_aiohttp_session(app)

    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)

    setup_common_static_routes(routes)
    app.add_routes(routes)

    web.run_app(
        deploy_config.prefix_application(app, 'ci'),
        host='0.0.0.0',
        port=5000,
        access_log_class=AccessLogger,
        ssl_context=internal_server_ssl_context(),
    )
示例#13
0
def run():
    app = web.Application()
    setup_aiohttp_session(app)

    setup_aiohttp_jinja2(app, 'monitoring')
    setup_common_static_routes(routes)
    app.add_routes(routes)
    app.router.add_get("/metrics", server_stats)

    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)

    web.run_app(
        deploy_config.prefix_application(app, 'monitoring'),
        host='0.0.0.0',
        port=5000,
        access_log_class=AccessLogger,
        ssl_context=internal_server_ssl_context(),
    )
示例#14
0
文件: notebook.py 项目: troels/hail
def run():
    sass_compile('notebook')
    root = os.path.dirname(os.path.abspath(__file__))

    # notebook
    notebook_app = web.Application()

    notebook_app.on_startup.append(on_startup)

    setup_aiohttp_jinja2(notebook_app, 'notebook')
    setup_aiohttp_session(notebook_app)

    routes.static('/static', f'{root}/static')
    setup_common_static_routes(routes)
    notebook_app.add_routes(routes)

    # workshop
    workshop_app = web.Application()

    workshop_app.on_startup.append(on_startup)

    setup_aiohttp_jinja2(workshop_app, 'notebook')
    setup_aiohttp_session(workshop_app)

    workshop_routes.static('/static', f'{root}/static')
    setup_common_static_routes(workshop_routes)
    workshop_app.add_routes(workshop_routes)

    # root app
    root_app = web.Application()
    root_app.add_domain(
        'notebook*', deploy_config.prefix_application(notebook_app,
                                                      'notebook'))
    root_app.add_domain(
        'workshop*', deploy_config.prefix_application(workshop_app,
                                                      'workshop'))
    web.run_app(root_app,
                access_log_format=
                '%a %t "%r" %s %b "%{Host}i" "%{Referer}i" "%{User-Agent}i"',
                host='0.0.0.0',
                port=5000)
示例#15
0
def run():
    sass_compile('notebook')
    root = os.path.dirname(os.path.abspath(__file__))

    # notebook
    notebook_app = web.Application()

    notebook_app.on_startup.append(on_startup)

    setup_aiohttp_jinja2(notebook_app, 'notebook')
    setup_aiohttp_session(notebook_app)

    routes.static('/static', f'{root}/static')
    setup_common_static_routes(routes)
    notebook_app.add_routes(routes)

    # workshop
    workshop_app = web.Application()

    workshop_app.on_startup.append(on_startup)

    setup_aiohttp_jinja2(workshop_app, 'notebook')
    setup_aiohttp_session(workshop_app)

    workshop_routes.static('/static', f'{root}/static')
    setup_common_static_routes(workshop_routes)
    workshop_app.add_routes(workshop_routes)

    # root app
    root_app = web.Application()
    root_app.add_domain(
        'notebook*', deploy_config.prefix_application(notebook_app,
                                                      'notebook'))
    root_app.add_domain(
        'workshop*', deploy_config.prefix_application(workshop_app,
                                                      'workshop'))
    web.run_app(root_app,
                host='0.0.0.0',
                port=5000,
                access_log_class=AccessLogger,
                ssl_context=get_in_cluster_server_ssl_context())
示例#16
0
文件: main.py 项目: chrisvittal/hail
def run():
    if HAIL_SHOULD_PROFILE and CLOUD == 'gcp':
        profiler_tag = f'{DEFAULT_NAMESPACE}'
        if profiler_tag == 'default':
            profiler_tag = DEFAULT_NAMESPACE + f'-{HAIL_SHA[0:12]}'
        googlecloudprofiler.start(
            service='batch-driver',
            service_version=profiler_tag,
            # https://cloud.google.com/profiler/docs/profiling-python#agent_logging
            verbose=3,
        )

    app = web.Application(client_max_size=HTTP_CLIENT_MAX_SIZE,
                          middlewares=[monitor_endpoints_middleware])
    setup_aiohttp_session(app)

    setup_aiohttp_jinja2(app, 'batch.driver')
    setup_common_static_routes(routes)
    app.add_routes(routes)
    app.router.add_get("/metrics", server_stats)

    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)

    asyncio.get_event_loop().add_signal_handler(signal.SIGUSR1,
                                                dump_all_stacktraces)

    web.run_app(
        deploy_config.prefix_application(app,
                                         'batch-driver',
                                         client_max_size=HTTP_CLIENT_MAX_SIZE),
        host='0.0.0.0',
        port=5000,
        access_log_class=AccessLogger,
        ssl_context=internal_server_ssl_context(),
    )