Jupyterhub: Fractional memory / CPU limits / guarantees fail

Created on 18 Apr 2017  路  3Comments  路  Source: jupyterhub/jupyterhub

How to reproduce the issue

Set memory limit (or guarantee, or cpu limit / guarantee) to a non-integral spec:

c.Spawner.mem_limit = "1.5G"

What you expected to happen

(In supported spawners) memory limit is set to 1.5 gigabytes of RAM

What actually happens

JupyterHub refuses to start, with:

[E 2017-04-18 05:39:02.270 JupyterHub app:1527]
    Traceback (most recent call last):
      File "/usr/local/lib/python3.4/dist-packages/jupyterhub/app.py", line 1524, in launch_instance_async
        yield self.initialize(argv)
      File "/usr/local/lib/python3.4/dist-packages/jupyterhub/app.py", line 1315, in initialize
        yield self.init_spawners()
      File "/usr/local/lib/python3.4/dist-packages/jupyterhub/app.py", line 1084, in init_spawners
        self.users[orm_user.id] = user = User(orm_user, self.tornado_settings)
      File "/usr/local/lib/python3.4/dist-packages/jupyterhub/user.py", line 128, in __init__
        config=self.settings.get('config'),
      File "/usr/local/lib/python3.4/dist-packages/kubespawner/spawner.py", line 29, in __init__
        super().__init__(*args, **kwargs)
      File "/usr/local/lib/python3.4/dist-packages/jupyterhub/spawner.py", line 345, in __init__
        super(Spawner, self).__init__(**kwargs)
      File "/usr/local/lib/python3.4/dist-packages/traitlets/config/configurable.py", line 84, in __init__
        self.config = config
      File "/usr/local/lib/python3.4/dist-packages/traitlets/traitlets.py", line 585, in __set__
        self.set(obj, value)
      File "/usr/local/lib/python3.4/dist-packages/traitlets/traitlets.py", line 574, in set
        obj._notify_trait(self.name, old_value, new_value)
      File "/usr/local/lib/python3.4/dist-packages/traitlets/traitlets.py", line 1139, in _notify_trait
        type='change',
      File "/usr/local/lib/python3.4/dist-packages/traitlets/traitlets.py", line 1176, in notify_change
        c(change)
      File "/usr/local/lib/python3.4/dist-packages/traitlets/traitlets.py", line 819, in compatible_observer
        return func(self, change)
      File "/usr/local/lib/python3.4/dist-packages/traitlets/config/configurable.py", line 186, in _config_changed
        self._load_config(change.new, traits=traits, section_names=section_names)
      File "/usr/local/lib/python3.4/dist-packages/traitlets/config/configurable.py", line 153, in _load_config
        setattr(self, name, deepcopy(config_value))
      File "/usr/local/lib/python3.4/dist-packages/traitlets/traitlets.py", line 585, in __set__
        self.set(obj, value)
      File "/usr/local/lib/python3.4/dist-packages/traitlets/traitlets.py", line 559, in set
        new_value = self._validate(obj, value)
      File "/usr/local/lib/python3.4/dist-packages/traitlets/traitlets.py", line 591, in _validate
        value = self.validate(obj, value)
      File "/usr/local/lib/python3.4/dist-packages/jupyterhub/traitlets.py", line 71, in validate
        return int(num) * ByteSpecification.UNIT_SUFFIXES[suffix]
    ValueError: invalid literal for int() with base 10: '1.5'

Share what version of JupyterHub you are using

0.72.

bug

Most helpful comment

I'm going to try to fix this for 0.8.

All 3 comments

@yuvipanda @minrk Has recent work closed this?

I think this bug still exists. Should be an easy enough fix to use float instead of int here, and then cast to int after multiplying.

I'm going to try to fix this for 0.8.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielrychel picture danielrychel  路  4Comments

sarath145p picture sarath145p  路  4Comments

zacharied picture zacharied  路  3Comments

qingzhouzhen picture qingzhouzhen  路  4Comments

whao picture whao  路  3Comments