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())
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_server_ssl_context())
def run(): app = web.Application() setup_aiohttp_jinja2(app, 'auth') setup_aiohttp_session(app) 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, 'auth'), host='0.0.0.0', port=5000, access_log_class=AccessLogger, ssl_context=get_server_ssl_context())
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_server_ssl_context())
return web.Response(status=403) raise ports = router.spec.ports assert len(ports) == 1 port = ports[0].port if port == 80: scheme = 'http' else: assert port == 443 scheme = 'https' return web.Response(status=200, headers={'X-Router-Scheme': scheme}) app.add_routes(routes) async def on_startup(app): if 'BATCH_USE_KUBE_CONFIG' in os.environ: await config.load_kube_config() else: config.load_incluster_config() app['k8s_client'] = client.CoreV1Api() app.on_startup.append(on_startup) web.run_app(app, host='0.0.0.0', port=5000, ssl_context=get_server_ssl_context())