builder#

Module: binderhub.builder#

Handlers for working with version control services (i.e. GitHub) for builds.

BuildHandler#

class binderhub.builder.BuildHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)#

A handler for working with GitHub.

async check_quota(provider)#

Check quota before proceeding with build/launch

Returns:

  • ServerQuotaCheck on success (None if no quota)

Raises:

  • LaunchQuotaExceeded if quota exceeded

async emit(data)#

Emit an eventstream event

get(provider_prefix, _unescaped_spec)#

Get a built image for a given spec and repo provider.

Different repo providers will require different spec information. This function relies on the functionality of the tornado GET request.

Parameters:
  • provider_prefix (str) – the nickname for a repo provider (i.e. ‘gh’)

  • spec – specifies information needed by the repo provider (i.e. user, repo, ref, etc.)

initialize()#
async keep_alive()#

Constantly emit keepalive events

So that intermediate proxies don’t terminate an idle connection

async launch(provider)#

Ask JupyterHub to launch the image.

on_finish()#

Stop keepalive when finish has been called

send_error(status_code, **kwargs)#

event stream cannot set an error code, so send an error event

set_default_headers()#

Override this to set HTTP headers at the beginning of the request.

For example, this is the place to set a custom Server header. Note that setting such headers in the normal flow of request processing may not do what you want, since headers may be reset during error handling.