Created
May 22, 2019 19:06
-
-
Save phaustin/f4302ed6d86083066411880c5682d034 to your computer and use it in GitHub Desktop.
jupyterhub resource report
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
global config: | |
https://github.com/pangeo-data/pangeo-cloud-federation/blob/eef3a575973f9789bcdb496b794e2334a88b4661/deployments/nasa/config/common.yaml#L59-L64 | |
Here is a handy function to print some user-friendly information. But this is for the node(EC2) that the pod is on, rather than the resource limits identified in the JupyterHub config above. So in our case, the effective resources available to you are about 1/2 of the total since we have set resource limits with the intension of putting two user pods on every machine... | |
def tell_system_status(): | |
# from https://www.programcreek.com/python/example/53878/psutil.disk_usage | |
import psutil | |
import platform | |
import datetime | |
os, name, version, _, _, _ = platform.uname() | |
version = version.split('-')[0] | |
cores = psutil.cpu_count() | |
cpu_percent = psutil.cpu_percent() | |
ram = psutil.virtual_memory().total >> 30 | |
memory_percent = psutil.virtual_memory()[2] | |
disk_percent = psutil.disk_usage('/')[3] | |
boot_time = datetime.datetime.fromtimestamp(psutil.boot_time()) | |
running_since = boot_time.strftime("%A %d. %B %Y") | |
response = "I am currently running on %s version %s. \n" % (os, version) | |
response += "This system is named %s \n" % (name) | |
response += "It has %s CPU cores. \n" % (cores) | |
response += "It has %s Gigabytes of RAM. \n" % (ram) | |
response += "Current disk_percent is %s percent. \n" % disk_percent | |
response += "Current CPU utilization is %s percent. \n" % cpu_percent | |
response += "Current memory utilization is %s percent. \n" % memory_percent | |
response += "it's running since %s. \n" % running_since | |
return response | |
print(tell_system_status()) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment