Package: jupyter-power-usage
jupyter-power-usageTry the extension onThe objective of this extension is to display power usage of the CPU and/or GPU on which jupyter server is running. Power usage is estimated usingRunning Average Power Limit (RAPL)metrics that are available on Intel processors manufactured after 2012 (since broadwell). It is available on latest AMD processors as well. For the case of GPUs, currently only nVIDIA GPUs are supported and power usage is gathered fromnvidia-smitool.Additionally, the extension is capable of estimating equivalent CO2emissions. Emissions are estimated based on the current power usage and a emission factor that gives equivalent grams of CO2power consumed. Currently, areal time emission factoris implemented for France and for the rest a constant configurablefactorof 475 gCO2.eq/kWh is used.The metrics are displayed in the top bar of JupyterLab and are updated at a configurable interval. The default interval is 5 seconds. RAPL can enforce power limit so as nVIDIA GPUs. If those power limits are enabled and available, they will be displayed in the indicators.NOTEThe extension works only on Linux that exposes RAPL metrics. Starting from kernel 5.4, RAPL metrics are accessibleonly for root. In this case, the user needs to add read permissions on/sys/fs/powercapdirectory to be able to display power usage indicators in JupyterLab.If the JupyterLab is running inside a container or VM, ensure that/sys/fs/powercapfile system exists. If it does not, extension will not work.The extension is not available for Notebook < 6. It supports JupyterLab >= 3 and Notebook >= 7.The extension's architecture closes follows thejupyter-resource-usageextension and all the credit goes to the contributors and maintainers of the above stated extension.InstallationJupyterLab 3.xYou should install the version<1.0.0for JupyterLab 3.x compatibility.pipinstall'jupyter-power-usage<1.0.0'JupyterLab 4.x and Notebook 7.xYou should install the latest version for JupyterLab 4.x and Notebook 7.x compatibility.pipinstalljupyter-power-usageThe extensiondoes not supportNotebook < 7.ConfigurationServer side configMeasurement ScopeCurrently the extension supports different measurement scopes:process: Power usage for current process and its children will be reporteduser: Power usage for current user processes will be reportedsystem: Power usage for entire system will be reported.By defaultprocessscope is used. The user can change it by CLI flag--PowerUsageDisplay.measurement_scopetojupyter labcommand. Alternatively, it can be configured injupyter_server_config.jsoninJupyter config directory.Frontend extension configThe frontend extension settings can be accessed bySettings -> Advanced Settings -> Power Usage Monitorin JupyterLab. Important settings are:Refresh Rate: Frequency at which power usage is updated in the JupyterLab. Do not use too small intervals as it will end up making too many API calls to update metrics.CPU labelandGPU labelsettings are self explanatory.Emissions Estimation SettingsCountry code: Currently only data for France is supported. The realtime emission factor fromRTE eCO2mix. We encourage users to add support for other countries. Please checkCONTRIBUTING.mdon how to do it. If your country is not available in the list, leave it blank.Refresh rate: This defines how often the emission factor is updated in ms. ForRTE eCO2mixdata, it is updated every 30 min and has a rate limit of 50000 API requests per month.Emission factor: This constant emission factor is used in the estimation of emissions when country specific data is unavailable.ContributingIf you would like to contribute to the project, please read theCONTRIBUTING.md. TheCONTRIBUTING.mdfile
explains how to set up a development installation and how to run the test suite.Uninstallpipuninstalljupyter_power_usageThis will uninstall python package and all the frontend related assets.TroubleshootingIf power indicators do not show up in the JupyterLab, try reload the browser tab.
Sometimes network latencies prevent extension to load in time.If there are any issues with the server side extension, they will be logged to the
same log that JupyterLab uses.