3

I have my python jupyter notebook configured in a docker container, I want to check if everything is configured correctly and all cpu and memory are available to jupyter.

How can I print out the cpu/memory available jupyter?

I understand all systems cpu/memory should be availablem, see here, but is there a pythonic way to get this info?

Not sure if this is related or not:

https://stackoverflow.com/a/4285292/2202107

EDIT: I was fearing that docker or jupyter will have a config file that limits its process's cpu/memory usage, but it turns out that resource monitor I was using iStat Menu was showing different resource usage than docker stats, which made me think jupyter/docker wasn't allocated all the resources. In fact, all the resources cpu/memory were utlized, according to docker stats. As a side note, please remember to set the cpu/mem limits on docker-machine.

Sida Zhou
  • 3,529
  • 2
  • 33
  • 48

1 Answers1

8

On Linux:

!cat /proc/meminfo | grep Mem

On OS X:

!top -l 1 -s 0 | grep PhysMem

wellplayed
  • 943
  • 8
  • 16
  • This only shows what OS sees, not the process (ie docker, jupyter) itself sees. – Sida Zhou Jan 08 '18 at 02:25
  • @Sida, what are you saying? What the OS reports is what is available in Jupyter. This isn't like Java 7 and earlier where the memory usage was defined like 512M, etc. Have you actually tried using memory in your notebook and looking at it go all the way down until you break the kernel (using something like top)? There are other ways to show memory usage for variables, but that isn't what you were looking for or was it? In any case, this is more reliable in terms of carrying out your tasks. Let me know exactly what you are looking for. Thx. – wellplayed Jan 19 '18 at 02:51