plasmabio / tljh-repo2docker

Plugin for The Littlest JupyterHub to build multiple user environments with repo2docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Display of env memory limit seems erroneous

pierrepo opened this issue · comments

I created a new env with these settings:

image

This env is then proposed to the user with the following properties:

image

The memory limit seems overestimated.

This issue could impact only 2 GB environments:

image

image

Good catch, thanks 👍

To give more context:

This is because the default memory limit (2GB at the moment) is now set via tljh-config in this playbook: https://github.com/plasmabio/plasmabio/blob/b1c8e6d26da368790fe7d8fc04469fe758020587/ansible/tljh.yml#L38-L41

And TLJH sets the values on the Spawner here: https://github.com/jupyterhub/the-littlest-jupyterhub/blob/68a84f1f926058142df39a7b4096ed758adf9ac6/tljh/configurer.py#L187

The mem_limit trait is defined as a ByteSpecification in jupyterhub: https://github.com/jupyterhub/jupyterhub/blob/289c3bc3c19951c12cfe540b8245571e299d44aa/jupyterhub/spawner.py#L525-L546

A ByteSpecification in jupyterhub.traitlets automatically parse the "2G" value into a bytes integer: https://github.com/jupyterhub/jupyterhub/blob/289c3bc3c19951c12cfe540b8245571e299d44aa/jupyterhub/traitlets.py#L90

We can transform this bytes value back into a human readable format before showing it it the user.