Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceUseDisplay instance expected an int or a callable, not the str #86

Open
masip85 opened this issue Feb 1, 2021 · 2 comments
Open

Comments

@masip85
Copy link

masip85 commented Feb 1, 2021

Installing nbresuse with conda for jupyterlab 2.2.9, I get following error at cpu_limit or memlimit when I use like this:

docker run --name ${NAME}_cont \
	--cpus=$CONTAINER_CPU_PER --cpuset-cpus=$CONTAINER_CPU_ARRAY \
	--memory=${CONTAINER_MEM} \
	[...]
	$IMAGE_NAME start.sh jupyter lab \
	--NotebookApp.password=$(<../.hashedPass.pwd) \
    --NotebookApp.base_url="/" \
    --NotebookApp.ResourceUseDisplay.mem_limit=${CONTAINER_MEM}   \
    --NotebookApp.ResourceUseDisplay.track_cpu_percent=True \
    --NotebookApp.ResourceUseDisplay.cpu_limit=$CONTAINER_CPU_NUM \
    --NotebookApp.allow_origin='https://colab.research.google.com' \
    --NotebookApp.port_retries=0
    

W 23:51:55.317 LabApp] Error loading server extension nbresuse
Traceback (most recent call last):
File "/opt/conda/lib/python3.8/site-packages/notebook/notebookapp.py", line 1945, in init_server_extensions
func(self)
File "/opt/conda/lib/python3.8/site-packages/nbresuse/init.py", line 35, in load_jupyter_server_extension
resuseconfig = ResourceUseDisplay(parent=nbapp)
File "/opt/conda/lib/python3.8/site-packages/traitlets/config/configurable.py", line 104, in init
self.config = config
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 604, in set
self.set(obj, value)
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 593, in set
obj._notify_trait(self.name, old_value, new_value)
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 1217, in _notify_trait
self.notify_change(Bunch(
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 1227, in notify_change
return self._notify_observers(change)
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 1264, in _notify_observers
c(event)
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 888, in compatible_observer
return func(self, change)
File "/opt/conda/lib/python3.8/site-packages/traitlets/config/configurable.py", line 208, in _config_changed
self._load_config(change.new, traits=traits, section_names=section_names)
File "/opt/conda/lib/python3.8/site-packages/traitlets/config/configurable.py", line 175, in _load_config
setattr(self, name, deepcopy(config_value))
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 604, in set
self.set(obj, value)
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 578, in set
new_value = self._validate(obj, value)
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 610, in _validate
value = self.validate(obj, value)
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 1981, in validate
self.error(obj, value)
File "/opt/conda/lib/python3.8/site-packages/traitlets/traitlets.py", line 690, in error
raise TraitError(e)
traitlets.traitlets.TraitError: The 'mem_limit' trait of a ResourceUseDisplay instance expected an int or a callable, not the str '14427566899'.

It's always a str, it doesn't matter I use hardcoded number, | bc ,or expr.

@masip85 masip85 changed the title The 'mem_limit' trait of a ResourceUseDisplay instance expected an int or a callable, not the str '1111'. ResourceUseDisplay instance expected an int or a callable, not the str Feb 1, 2021
@jtpio
Copy link
Member

jtpio commented Feb 2, 2021

Thanks @masip85.

This looks like an issue with traitlets 5, and a change in the way command line parameters are parsed.

It will probably for now by downgrading to traitlets 4. Although this indicates a fix in jupyter-resource-usage might also be needed.

@masip85
Copy link
Author

masip85 commented Feb 2, 2021

So requirements of jupyter-resource-usage must change? I mean,if I want to downgrade,major changes have to be applied:

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - traitlets=4.2.1 -> python=3.6
  - traitlets=4.2.1 -> python[version='2.7.*|3.4.*|3.5.*']

Your python: python=3.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants