6.3. builder

6.3.1. Module: binderhub.builder

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

6.3.2. BuildHandler

class binderhub.builder.BuildHandler(application, request, **kwargs)

A handler for working with GitHub.

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

Hook for subclass initialization. Called for each request.

A dictionary passed as the third argument of a url spec will be supplied as keyword arguments to initialize().

Example:

class ProfileHandler(RequestHandler):
    def initialize(self, database):
        self.database = database

    def get(self, username):
        ...

app = Application([
    (r'/user/(.*)', ProfileHandler, dict(database=database)),
    ])
keep_alive()

Constantly emit keepalive events

So that intermediate proxies don’t terminate an idle connection

launch(kube)

Ask JupyterHub to launch the image.

on_finish()

Stop keepalive when finish has been called

pool = None

—– Build starts here —–

send_error(status_code, **kwargs)

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