Skip to content

Commit

Permalink
Merge branch 'release/0.1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
raethlein committed Nov 22, 2019
2 parents 45f004a + 381d085 commit 7f824ac
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mltooling/ssh-proxy:0.1.8
FROM mltooling/ssh-proxy:0.1.10

WORKDIR /

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ We override [DockerSpawner](https://github.com/ml-tooling/ml-hub/blob/master/res

- Create / delete services for a workspace, so that the hub can access them via Kubernetes DNS.

All resources created by our custom spawners are labeled (Docker / Kubernetes labels) with the labels `mlhub.origin` set to the Hub name `$ENV_HUB_NAME`, `mlhub.user` set to the JupyterHub user the resources belongs to, and `mlhub.server_name` to the named server name. For example, if the hub name is "mlhub" and a user named "foo" has a named server "bar", the labels would be `mlhub.origin=mlhub`, `mlhub.user=foo`, `mlhub.server_name=bar`.

## Support

The ML Hub project is maintained by [@raethlein](https://twitter.com/raethlein) and [@LukasMasuch](https://twitter.com/LukasMasuch). Please understand that we won't be able
Expand Down Expand Up @@ -226,6 +228,10 @@ The service has two endpoints which can be reached under the Hub service url `/s

- `GET /services/cleanup-service/expired`: When starting a named workspace, an expiration date can be assigned to it. This endpoint will delete all containers that are expired. The respective named server is deleted from the JupyterHub database and also the Docker/Kubernetes resource is deleted.

## Customization

- Logo: if you want to have your own logo in the corner, place it at `/usr/local/share/jupyterhub/static/images/jupyter.png` inside the hub container.

## Contribution

- Pull requests are encouraged and always welcome. Read [`CONTRIBUTING.md`](https://github.com/ml-tooling/ml-hub/tree/master/CONTRIBUTING.md) and check out [help-wanted](https://github.com/ml-tooling/ml-hub/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+label%3A"help+wanted"+sort%3Areactions-%2B1-desc+) issues.
Expand Down
4 changes: 4 additions & 0 deletions resources/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ fi
$_RESOURCES_PATH/scripts/setup_certs.sh

function start_ssh {
"""See the documentation of the ssh-proxy image
- the image this hub image is based on - for more information"""

echo "Start SSH Daemon service"
export SSH_TARGET_LABELS="mlhub.origin=$HUB_NAME"
# Run ssh-bastion image entrypoint
nohup python $_RESOURCES_PATH/start_ssh.py &
}
Expand Down
4 changes: 3 additions & 1 deletion resources/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def combine_config_dicts(*configs) -> dict:

# Connect containers to this Docker network
c.Spawner.use_internal_ip = True
c.Spawner.extra_host_config = { 'shm_size': '256m' }

c.Spawner.prefix = 'ws'
c.Spawner.name_template = c.Spawner.prefix + '-{username}-' + ENV_HUB_NAME + '{servername}' # override in your config when you want to have a different name schema. Also consider changing c.Authenticator.username_pattern and check the environment variables to permit ssh connection
Expand Down Expand Up @@ -161,6 +160,9 @@ def combine_config_dicts(*configs) -> dict:


elif ENV_EXECUTION_MODE == utils.EXECUTION_MODE_LOCAL:
# shm_size can only be set for Docker, not Kubernetes (see https://stackoverflow.com/questions/43373463/how-to-increase-shm-size-of-a-kubernetes-container-shm-size-equivalent-of-doc)
c.Spawner.extra_host_config = { 'shm_size': '256m' }

client_kwargs = {**get_or_init(c.DockerSpawner.client_kwargs, dict), **get_or_init(c.MLHubDockerSpawner.client_kwargs, dict)}
tls_config = {**get_or_init(c.DockerSpawner.tls_config, dict), **get_or_init(c.MLHubDockerSpawner.tls_config, dict)}

Expand Down
2 changes: 1 addition & 1 deletion resources/mlhubspawner/mlhubspawner/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
LABEL_NVIDIA_VISIBLE_DEVICES = 'nvidia_visible_devices'
LABEL_EXPIRATION_TIMESTAMP = 'expiration_timestamp_seconds'

LABEL_MLHUB_ORIGIN = "mlhub.origin"
LABEL_MLHUB_USER = "mlhub.user"
LABEL_MLHUB_SERVER_NAME = "mlhub.server_name"

Expand All @@ -23,7 +24,6 @@
EXECUTION_MODE_KUBERNETES = "k8s"
ENV_NAME_CLEANUP_INTERVAL_SECONDS = "CLEANUP_INTERVAL_SECONDS"

LABEL_MLHUB_ORIGIN = "mlhub.origin"
ENV_HUB_NAME = os.getenv("HUB_NAME", "mlhub")

def get_lifetime_timestamp(labels: dict) -> float:
Expand Down

0 comments on commit 7f824ac

Please sign in to comment.