jupyter / nbmanager

View and stop running IPython notebook servers
51 stars 20 forks source link

Program freezes when run on windows #11

Open ajasja opened 7 years ago

ajasja commented 7 years ago

Hi!

Great idea, I've been looking for a way to manage all the run servers. However, the program just frezzes when run on windows 8. (And also makes my system sluggish). However there is no excessive CPU usage.

I'm not sure how I should start debugging this.

I'm using python 3.4.5 with Ipython 5.

Full packages available here.

takluyver commented 7 years ago

How long does running this Python code take:

for server in nbmanager.api.NbServer.findall():
    print(server.sessions())

That's what the GUI needs to do to find the running notebook servers - it runs that once a second to update the list. If it's slow, I can imagine that would make the program lock up, though I don't know why it would make the rest of the system sluggish.

ajasja commented 7 years ago

Thanks for your answer; The code takes about 8 s: image

However just printing the directory and/or port takes about 25 ms.

%%time
servers = nbmanager.api.NbServer.findall()
for server in servers:
    print(server.port)
8888
8786
8890
8888
8889
8888
8984
Wall time: 23 ms

So the problem seems to be in the sessions function call.

takluyver commented 7 years ago

We probably need to find a more efficient way to do that - it makes an HTTP request to each server to get the list of running notebook sessions.

ajasja commented 7 years ago

I stripped (hacked) the sessions handling from the GUI and now the applications works fine:)

Perhaps getting the sessions could be done on a per demand basis (a button with get sessions) or on double clicking a server Item?

takluyver commented 7 years ago

From a user perspective, I like having the sessions readily available there - especially as I think many users will run with all their sessions in just one or two servers. We just need to handle the communications in a way that doesn't block the GUI, probably using some machinery like QNetworkAccessManager.

ajasja commented 7 years ago

That's a good idea. And the request could be sent to each server in parallel as well. But the sessions probably don't change every second...

The main problem I'm trying to solve is that I have a lot of servers open and I forget where they are and if I have to shut them down (some sessions are quite RAM intensive)