launcher#
Module: binderhub.launcher
#
Launch an image with a temporary user via JupyterHub
Launcher
#
- class binderhub.launcher.Launcher(**kwargs: Any)#
Object for encapsulating launching an image for a user
- allow_named_servers c.Launcher.allow_named_servers = Bool(False)#
Named user servers are allowed. This is used only when authentication is enabled and to set unique names for user servers.
- async api_request(url, *args, **kwargs)#
Make an API request to JupyterHub
- create_user Bool(True)#
Create a new Hub user
- hub_api_token Unicode('')#
The API token for the Hub
- hub_url Unicode('')#
The URL of the Hub
- hub_url_local Unicode('')#
The internal URL of the Hub if different
- async launch(image, username, server_name='', repo_url='', extra_args=None, event_callback=None)#
Launch a server for a given image
creates a temporary user on the Hub if authentication is not enabled
spawns a server for temporary/authenticated user
generates a token
returns a dict containing: -
url
: the URL of the server -image
: image spec -repo_url
: the url of the repo -extra_args
: Dictionary of extra arguments passed to the server -token
: the token for the server
- launch_timeout c.Launcher.launch_timeout = Int(600)#
Wait this many seconds until server is ready, raise TimeoutError otherwise.
- named_server_limit_per_user c.Launcher.named_server_limit_per_user = Int(0)#
Maximum number of concurrent named servers that can be created by a user.
- pre_launch_hook c.Launcher.pre_launch_hook = Callable(None)#
An optional hook function that you can use to implement checks before starting a user’s server. For example if you have a non-standard BinderHub deployment, in this hook you can check if the current user has right to launch a new repo.
Receives 5 parameters: launcher, image, username, server_name, repo_url
- retries c.Launcher.retries = Int(4)#
Number of attempts to make on Hub API requests.
Adds resiliency to intermittent Hub failures, most commonly due to Hub, proxy, or ingress interruptions.
- retry_delay c.Launcher.retry_delay = Int(4)#
Time (seconds) to wait between retries for Hub API requests.
Time is scaled exponentially by the retry attempt (i.e. 2, 4, 8, 16 seconds)
- unique_name_from_repo(repo_url)#
Generate a unique name for a git repo url
e.g. minrk-binder-example-abc123 from minrk/binder-example.git