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
- check_request_ip()#
Check network block list, if any
- async emit(data)#
Emit an eventstream event
- emit_launch_event(provider, spec, ref)#
Emit a single launch event to the activity log
- 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
GETrequest.- 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
- async prepare()#
Called at the beginning of a request before
get/post/etc.Override this method to perform common initialization regardless of the request method. There is no guarantee that
preparewill be called if an error occurs that is handled by the framework.Asynchronous support: Use
async defor decorate this method with.gen.coroutineto make it asynchronous. If this method returns anAwaitableexecution will not proceed until theAwaitableis done.Added in version 3.1: Asynchronous support.
- redirect(*args, **kwargs)#
Sends a redirect to the given (optionally relative) URL.
If the
statusargument is specified, that value is used as the HTTP status code; otherwise either 301 (permanent) or 302 (temporary) is chosen based on thepermanentargument. The default is 302 (temporary).
- 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
Serverheader. 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.