jupyterlab-system-monitor icon indicating copy to clipboard operation
jupyterlab-system-monitor copied to clipboard

The top bar recently stopped working. TypeError: object Future can't be used in 'await' expression

Open anigmo97 opened this issue 3 years ago • 5 comments

Hi everyone, I have been using this extension for two weeks and everything went fine but suddenly it stopped working.

Because of the browser errors and the logs I would say that you cannot get any metrics.

Can somebody help me?

My versions are:

jupyter-client                   6.1.7       
jupyter-core                     4.6.3       
jupyterhub                       1.0.0       
jupyterlab                       2.2.8           
jupyterlab-pygments              0.1.2       
jupyterlab-server                1.2.0       
nbclient                         0.5.0       
nbconvert                        5.6.1       
nbdime                           2.1.0       
nbformat                         5.0.7       
nbresuse                         0.3.6       
notebook                         6.1.4       
widgetsnbextension               3.5.1

Checking my jupyterlab extensions all seems fine:

jupyter labextension list
JupyterLab v2.2.8
Known labextensions:
   app dir: /opt/conda/share/jupyter/lab
        @jupyterlab/git v0.22.0  enabled  OK
        jupyterlab-system-monitor v0.6.0  enabled  OK
        jupyterlab-topbar-extension v0.5.0  enabled  OK
        nbdime-jupyterlab v2.0.1  enabled  OK

Checking Jupyterlab logs:

[E 2020-10-15 07:12:40.564 SingleUserNotebookApp log:174] 500 GET /user/user3/metrics ([email protected]) 10.20ms
[E 2020-10-15 07:12:41.294 SingleUserNotebookApp web:1621] Uncaught exception GET /user/user3/metrics (127.0.0.1)
    HTTPServerRequest(protocol='http', host='192.168.1.44:8000', method='GET', uri='/user/user3/metrics', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute
        result = yield result
      File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
        value = future.result()
      File "/opt/conda/lib/python3.6/site-packages/nbresuse/api.py", line 49, in get
        cpu_percent = await self._get_cpu_percent(all_processes)
    TypeError: object Future can't be used in 'await' expression

Checking the browser logs : image

anigmo97 avatar Oct 15 '20 07:10 anigmo97

Thanks @anigmo97.

Looks like it is an issue with nbresuse which is used to retrieve the metrics.

jtpio avatar Oct 16 '20 11:10 jtpio

I've just installed the extension and I am experiencing same issue - I see only separators in the bar but no actual metrics. Is there something that can be done to resolve it or it's a bigger issue with some dependencies? I am using JL 2.1.5 (running in virtual environment).

michalrudko avatar Oct 24 '20 21:10 michalrudko

I've just installed the extension and I am experiencing same issue - I see only separators in the bar but no actual metrics. Is there something that can be done to resolve it or it's a bigger issue with some dependencies? I am using JL 2.1.5 (running in virtual environment).

Hi, the problem seems to be related only with the CPU usage.

If you change this in jupyter_notebook_config.py

c.NotebookApp.ResourceUseDisplay.track_cpu_percent = False

You will be able to see the RAM usage bar

anigmo97 avatar Oct 24 '20 22:10 anigmo97

I've just installed the extension and I am experiencing same issue - I see only separators in the bar but no actual metrics. Is there something that can be done to resolve it or it's a bigger issue with some dependencies? I am using JL 2.1.5 (running in virtual environment).

Hi, the problem seems to be related only with the CPU usage.

If you change this in jupyter_notebook_config.py

c.NotebookApp.ResourceUseDisplay.track_cpu_percent = False

You will be able to see the RAM usage bar

Thanks for a quick reply! Is this something I can configure in JupyterHub config as well? (this is a multiuser environment, sessions are spawned based on jupyterhub_config.py)

michalrudko avatar Oct 24 '20 23:10 michalrudko

I've just installed the extension and I am experiencing same issue - I see only separators in the bar but no actual metrics. Is there something that can be done to resolve it or it's a bigger issue with some dependencies? I am using JL 2.1.5 (running in virtual environment).

Hi, the problem seems to be related only with the CPU usage. If you change this in jupyter_notebook_config.py

c.NotebookApp.ResourceUseDisplay.track_cpu_percent = False

You will be able to see the RAM usage bar

Thanks for a quick reply! Is this something I can configure in JupyterHub config as well? (this is a multiuser environment, sessions are spawned based on jupyterhub_config.py)

Hello, yes this can be configured also using jupyterHub.

I'm also using jupyterHub.

I'm not an expert, but i let you what i understood.

First we have to differents configuration files:

  1. jupyterhub_config.py (for jupyter_hub).
  2. jupyter_notebook_config.py (at jupyter_notebook level). This file must be on jupyter path (like /usr/local/etc/jupyter/jupyter_notebook_config.py).

So, this extension settings must be on jupyter_notebook_config.py As example, my /usr/local/etc/jupyter/jupyter_notebook_config.py file looks like:

c = get_config()

# memoryand cpu display settings
c.NotebookApp.ResourceUseDisplay.mem_limit = int(3 * 1024 * 1024 * 1024)
c.NotebookApp.ResourceUseDisplay.track_cpu_percent = False
c.NotebookApp.ResourceUseDisplay.cpu_limit = 3
# 10 % free memory
c.NotebookApp.ResourceUseDisplay.mem_warning_threshold = 0.1

And my jupyterhub_config.py looks like:

c.JupyterHub.port = 8000
c.Spawner.default_url = '/lab'
...

I hope it helps

anigmo97 avatar Oct 25 '20 09:10 anigmo97

Closing as jupyterlab-system-monitor has now been integrated in jupyter-resource-usage: https://github.com/jupyter-server/jupyter-resource-usage/issues/191

Feel free to open a new issue on the jupyter-resource-usage repo if needed: https://github.com/jupyter-server/jupyter-resource-usage

Thanks!

jtpio avatar Jul 28 '23 14:07 jtpio