コード例 #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():
    routes.static('/static', f'{notebook_root}/static')
    app = web.Application()

    setup_aiohttp_session(app)

    app.add_routes(routes)
    app.on_startup.append(on_startup)
    aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader(os.path.join(notebook_root, 'templates')))
    web.run_app(deploy_config.prefix_application(app, 'notebook2'), host='0.0.0.0', port=5000)
コード例 #5
0
def run():
    app = web.Application()

    setup_aiohttp_session(app)

    app.add_routes(routes)
    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_cleanup)

    web.run_app(deploy_config.prefix_application(app, 'auth'), host='0.0.0.0', port=5000)
コード例 #6
0
ファイル: scorecard.py プロジェクト: steveherrin/hail
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)
コード例 #7
0
ファイル: notebook.py プロジェクト: TileDB-Inc/hail
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
コード例 #8
0
ファイル: notebook.py プロジェクト: populationgenomics/hail
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
コード例 #9
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,
                access_log_class=AccessLogger)
コード例 #10
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())
コード例 #11
0
ファイル: query.py プロジェクト: tuyanglin/hail
def run():
    app = web.Application()

    setup_aiohttp_session(app)

    app.add_routes(routes)

    app.on_startup.append(on_startup)

    deploy_config = get_deploy_config()
    web.run_app(deploy_config.prefix_application(app, 'query'),
                host='0.0.0.0',
                port=5000,
                access_log_class=AccessLogger,
                ssl_context=get_in_cluster_server_ssl_context())
コード例 #12
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)
コード例 #13
0
ファイル: memory.py プロジェクト: TileDB-Inc/hail
def run():
    app = web.Application()

    setup_aiohttp_session(app)
    app.add_routes(routes)
    app.router.add_get("/metrics", server_stats)

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

    deploy_config = get_deploy_config()
    web.run_app(deploy_config.prefix_application(app, 'memory'),
                host='0.0.0.0',
                port=5000,
                access_log_class=AccessLogger,
                ssl_context=internal_server_ssl_context())
コード例 #14
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.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())
コード例 #15
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)
コード例 #16
0
ファイル: ci.py プロジェクト: chrisvittal/hail
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)
    app.router.add_get("/metrics", server_stats)

    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(),
    )
コード例 #17
0
ファイル: atgu.py プロジェクト: TileDB-Inc/hail
def run():
    app = web.Application()

    setup_aiohttp_session(app)

    aiohttp_jinja2.setup(app,
                         loader=jinja2.ChoiceLoader(
                             [jinja2.PackageLoader('atgu')]))

    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, 'atgu'),
                host='0.0.0.0',
                port=5000,
                access_log_class=AccessLogger,
                ssl_context=internal_server_ssl_context())
コード例 #18
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)
コード例 #19
0
ファイル: notebook.py プロジェクト: tuyanglin/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,
                host='0.0.0.0',
                port=5000,
                access_log_class=AccessLogger,
                ssl_context=get_in_cluster_server_ssl_context())
コード例 #20
0
def run():
    app = web.Application(middlewares=[monitor_endpoints_middleware])

    setup_aiohttp_session(app)
    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)

    deploy_config = get_deploy_config()
    web.run_app(
        deploy_config.prefix_application(app, 'memory'),
        host='0.0.0.0',
        port=5000,
        access_log_class=AccessLogger,
        ssl_context=internal_server_ssl_context(),
    )
コード例 #21
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(),
    )
コード例 #22
0
ファイル: ci.py プロジェクト: mcconlogue/hail
          'r') as f:
    oauth_token = f.read().strip()

configure_logging()
log = logging.getLogger('ci')

uvloop.install()

watched_branches = [
    WatchedBranch(index, FQBranch.from_short_str(bss), deployable)
    for (index, [bss, deployable]) in enumerate(
        json.loads(os.environ.get('HAIL_WATCHED_BRANCHES', '[]')))
]

app = web.Application()
setup_aiohttp_session(app)

routes = web.RouteTableDef()

start_time = datetime.datetime.now()


@routes.get('/')
@web_authenticated_developers_only()
async def index(request, userdata):  # pylint: disable=unused-argument
    app = request.app
    dbpool = app['dbpool']
    wb_configs = []
    for i, wb in enumerate(watched_branches):
        if wb.prs:
            pr_configs = []