Package: megaclite
<p align="center"><img src="megaclite/static/megaclite_350.png" style="max-width:50%;"/></p># megaclite## Resource Manager for JupyterHub, also a moon.[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.png?v=103)](https://github.com/alivcor/segraph)[![dependencies Status](https://david-dm.org/boennemann/badges/status.svg)](https://github.com/alivcor/segraph)[![Build Status](https://travis-ci.org/alivcor/megaclite.svg?branch=master)](https://travis-ci.org/alivcor/megaclite)<p align="center"><img src="megaclite_demo.gif" /></p>Megaclite provides monitoring, auditing & management for JupyterHub.<a href="https://github.com/alivcor/megaclite">:octocat: Link to GitHub Repo</a>## Getting StartedMegaclite provides the following functionalities:- A small label in the toolbar to display memory utilization (summed across all notebooks) on client side- Warning pop-up when user exhausts 75% of his/her memory limit on client-side.- Alert pop-up when user crosses his/her memory limit on client-side.- Kills kernel/session when user surpasses the limits.- Auditing on server-side.Make sure you have sudospawner up and running.### PrerequisitesYou will need to have Sudospawner installed on your system. The megaclite extension was built with Python 3.6, and it is NOT made for Python 2.7, so is JupyterHub.```pip install megaclite```### InstallationThere are multiple ways to install megaclite on your system:#### Python Package Indexmegaclite is now available at https://pypi.python.org/pypi/megaclite/0.1```1. Download the tar/zip from https://pypi.python.org/pypi/megaclite/0.12. Move the package to your desired location / python version, and unzip the archive.Optionally, if you have a linux-based machine (Ubuntu/OSX):tar xvzf megaclite-0.x.tar.gz -C /path/to/desireddirectory3. Migrate to the megaclite folder, and runpython setup.py install```#### Using pip```pip install megaclite```To upgrade,```pip install --upgrade megaclite```## Using megaclitemegaclite bouples BEST with Sudospawner. You need a JupyterHub API Token to use megaclite.## Create an API tokenTo send requests using JupyterHub API, you must pass an API token withthe request.As of version 0.6.0, the preferred way ofgenerating an API token is:```bashopenssl rand -hex 32```This `openssl` command generates a potential token that can then beadded to JupyterHub using `.api_tokens` configuration setting in`jupyterhub_config.py`.Alternatively, use the `jupyterhub token` command to generate a tokenfor a specific hub user by passing the 'username':```bashjupyterhub token <username>```This command generates a random string to use as a token and registersit for the given user with the Hub's database.In JupyterHub version 0.8.0, a TOKEN request page forgenerating an API token is available from the JupyterHub user interface:![Request API TOKEN page](https://github.com/jupyterhub/jupyterhub/raw/master/docs/source/images/token-request.png)![API TOKEN success page](https://github.com/jupyterhub/jupyterhub/raw/master/docs/source/images/token-request-success.png)## Add API tokens to the config fileYou may also add a dictionary of API tokens and usernames to the hub'sconfiguration file, `jupyterhub_config.py` (note thatthe **key** is the 'secret-token' while the **value** is the 'username'):```pythonc.JupyterHub.api_tokens = {'secret-token': 'username',}```## Make the username an adminThis is required to be able to kill sessions in the event of user surpassing memory limits.```pythonc.JupyterHub.admin_users = {'username'}```NOTE: If you skip this, Megaclite will NOT be able to kill sessions.## Enabling the extensioninstall both the serverextension and the toolbar button (nbextension) with:```bashpip install megaclitejupyter serverextension enable --py megaclite --sys-prefixjupyter nbextension install --py megaclite --sys-prefixjupyter nbextension enable --py megaclite --sys-prefix```You can check that the install was successful with:```bashjupyter nbextension listjupyter serverextension list```You may also enable it from the nbextensions-configurator UI.## See the magic unleash<p align="center"><img src="megaclite_demo.png" /></p>## ContributingYou are welcome to raise issues / send a pull-request.## Authors* **Abhinandan Dubey** - *@alivcor* - [Human Interaction Lab, Stony Brook University](https://www.cs.stonybrook.edu/~adubey)## LicenseThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details[![forthebadge](http://forthebadge.com/images/badges/makes-people-smile.svg)](https://github.com/alivcor/segraph/#)