How to use the gear.web_authenticated_users_only function in gear

To help you get started, we’ve selected a few gear examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hail-is / hail / batch / batch / front_end / front_end.py View on Github external
@web_authenticated_users_only(redirect=False)
async def ui_cancel_batch(request, userdata):
    batch_id = int(request.match_info['batch_id'])
    user = userdata['username']
    await _cancel_batch(request.app, batch_id, user)
    session = await aiohttp_session.get_session(request)
    set_message(session, f'Batch {batch_id} cancelled.', 'info')
    location = request.app.router['batches'].url_for()
    raise web.HTTPFound(location=location)
github hail-is / hail / batch / batch / batch.py View on Github external
@web_authenticated_users_only()
async def ui_batch(request, userdata):
    batch_id = int(request.match_info['batch_id'])
    user = userdata['username']
    page_context = {
        'batch': await _get_batch(batch_id, user, include_jobs=True)
    }
    return await render_template('batch', request, userdata, 'batch.html', page_context)
github hail-is / hail / notebook / notebook / notebook.py View on Github external
@web_authenticated_users_only(redirect=False)
async def get_auth(request, userdata):
    return await _get_auth(request, userdata)
github hail-is / hail / batch / batch / batch.py View on Github external
@web_authenticated_users_only(redirect=False)
async def ui_cancel_batch(request, userdata):
    batch_id = int(request.match_info['batch_id'])
    user = userdata['username']
    await _cancel_batch(batch_id, user)
    session = await aiohttp_session.get_session(request)
    set_message(session, 'Batch {batch_id} cancelled.', 'info')
    location = request.app.router['batches'].url_for()
    raise web.HTTPFound(location=location)
github hail-is / hail / notebook / notebook / notebook.py View on Github external
@web_authenticated_users_only(redirect=False)
async def post_notebook(request, userdata):
    return await _post_notebook('notebook', request, userdata)
github hail-is / hail / notebook2 / notebook / notebook.py View on Github external
@web_authenticated_users_only(redirect=False)
async def wait_websocket(request, userdata):  # pylint: disable=unused-argument
    k8s = request.app['k8s_client']
    session = await aiohttp_session.get_session(request)
    notebook = session.get('notebook')

    if not notebook:
        return web.HTTPNotFound()

    ws = web.WebSocketResponse()
    await ws.prepare(request)

    pod_name = notebook['pod_name']
    if notebook['pod_ip']:
        ready_url = deploy_config.external_url('notebook2', f'/instance-ready/{notebook["pod_uuid"]}')
        attempts = 0
        while attempts < 10:
github hail-is / hail / notebook2 / notebook / notebook.py View on Github external
@web_authenticated_users_only()
async def notebook_page(request, userdata):
    k8s = request.app['k8s_client']

    notebook = await get_live_notebook(k8s, userdata)
    session = await aiohttp_session.get_session(request)
    if notebook:
        session['notebook'] = notebook
    else:
        if 'notebook' in session:
            del session['notebook']

    context = base_context(deploy_config, userdata, 'notebook2')
    context['notebook'] = notebook
    return context
github hail-is / hail / batch / batch / front_end / front_end.py View on Github external
@web_authenticated_users_only()
async def ui_batch(request, userdata):
    app = request.app
    batch_id = int(request.match_info['batch_id'])
    user = userdata['username']

    batch = await _get_batch(app, batch_id, user)

    jobs, last_job_id = await _query_batch_jobs(request, batch_id)
    for job in jobs:
        job['exit_code'] = Job.exit_code(job)
        job['duration'] = humanize_timedelta_msecs(Job.total_duration_msecs(job))
    batch['jobs'] = jobs

    page_context = {
        'batch': batch,
        'q': request.query.get('q'),