Skip to content

Commit

Permalink
Merge pull request #2 from mahendrapaipuri/update_config_readme
Browse files Browse the repository at this point in the history
Update `package.json` config and README
  • Loading branch information
mahendrapaipuri authored Oct 12, 2023
2 parents 15e5bc4 + d87116a commit d8fc444
Show file tree
Hide file tree
Showing 14 changed files with 180 additions and 148 deletions.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

40 changes: 0 additions & 40 deletions .eslintrc.js

This file was deleted.

38 changes: 19 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@ name: Build

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install 'jupyterlab>=3.0.0,<4'
- name: Install dependencies
run: python -m pip install 'jupyterlab>=3.0.0,<4'

- name: Install the extension
run: |
python -m pip install .
jupyter server extension enable --py jupyter_power_usage --sys-prefix
- name: Install the extension
run: |
python -m pip install .
jupyter server extension enable --py jupyter_power_usage --sys-prefix
- name: Check the server and lab extensions are installed
run: |
jupyter server extension list 2>&1 | grep -ie "jupyter_power_usage.*enabled"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@mahendrapaipuri/jupyter-power-usage.*OK"
python -m jupyterlab.browser_check
- name: Check the server and lab extensions are installed
run: |
jupyter server extension list 2>&1 | grep -ie "jupyter_power_usage.*enabled"
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "@mahendrapaipuri/jupyter-power-usage.*OK"
python -m jupyterlab.browser_check
2 changes: 1 addition & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Check Release
on:
push:
branches: [ master, main ]
branches: [master, main]
pull_request:
branches:
- '*'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Lint

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
lint:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/prep-release.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: "Step 1: Prep Release"
name: 'Step 1: Prep Release'
on:
workflow_dispatch:
inputs:
version_spec:
description: "New Version Specifier"
default: "next"
description: 'New Version Specifier'
default: 'next'
required: false
branch:
description: "The branch to target"
description: 'The branch to target'
required: false
post_version_spec:
description: "Post Version Specifier"
description: 'Post Version Specifier'
required: false
since:
description: "Use PRs with activity since this date or git reference"
description: 'Use PRs with activity since this date or git reference'
required: false
since_last_stable:
description: "Use PRs with activity since the last stable git tag"
description: 'Use PRs with activity since the last stable git tag'
required: false
type: boolean
jobs:
Expand All @@ -37,6 +37,6 @@ jobs:
since: ${{ github.event.inputs.since }}
since_last_stable: ${{ github.event.inputs.since_last_stable }}

- name: "** Next Step **"
- name: '** Next Step **'
run: |
echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}"
12 changes: 6 additions & 6 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: "Step 2: Publish Release"
name: 'Step 2: Publish Release'
on:
workflow_dispatch:
inputs:
branch:
description: "The target branch"
description: 'The target branch'
required: false
release_url:
description: "The URL of the draft GitHub release"
description: 'The URL of the draft GitHub release'
required: false
steps_to_skip:
description: "Comma separated list of steps to skip"
description: 'Comma separated list of steps to skip'
required: false

jobs:
Expand Down Expand Up @@ -46,13 +46,13 @@ jobs:
target: ${{ github.event.inputs.target }}
release_url: ${{ steps.populate-release.outputs.release_url }}

- name: "** Next Step **"
- name: '** Next Step **'
if: ${{ success() }}
run: |
echo "Verify the final release"
echo ${{ steps.finalize-release.outputs.release_url }}
- name: "** Failure Message **"
- name: '** Failure Message **'
if: ${{ failure() }}
run: |
echo "Failed to Publish the Draft Release Url:"
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Tests

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
Expand All @@ -13,26 +13,26 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.11"]
python-version: ['3.8', '3.11']

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: |
python -m pip install -e ".[dev]"
- name: Install dependencies
run: |
python -m pip install -e ".[dev]"
- name: Lint with flake8
run: |
python -m flake8 jupyter_power_usage
- name: Lint with flake8
run: |
python -m flake8 jupyter_power_usage
- name: Test with pytest
run: |
python -m pytest
- name: Test with pytest
run: |
python -m pytest
check_links:
runs-on: ubuntu-latest
Expand Down
65 changes: 42 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,43 @@
repos:
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
language_version: python3
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: "6.1.0"
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
exclude: ^helm-chart/nbviewer/templates/
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
language_version: python3
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: '6.1.0'
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.1.1
hooks:
- id: prettier
additional_dependencies:
- [email protected]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v7.32.0
hooks:
- id: eslint
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
types: [file]
additional_dependencies:
- '@typescript-eslint/[email protected]'
- '@typescript-eslint/[email protected]'
- eslint@^7.14.0
- [email protected]
- [email protected]
- [email protected]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: check-json
- id: check-yaml
exclude: ^helm-chart/nbviewer/templates/
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

14 changes: 0 additions & 14 deletions .stylelintrc

This file was deleted.

14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
[![PyPI](https://img.shields.io/pypi/l/jupyter-power-usage)](https://pypi.python.org/pypi/jupyter-power-usage)
[![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/jupyter-server/jupyter-resource-usage/issues)

![Screencast for power usage](./doc/power-usage.gif)
![Screencast for power usage](https://raw.githubusercontent.com/mahendrapaipuri/jupyter-power-usage/main/doc/power-usage.gif)

The 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 using [Running Average Power Limit (RAPL)](https://web.eece.maine.edu/~vweaver/projects/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 from `nvidia-smi` tool.

Additionally, the extension is capable of estimating equivalent CO<sub>2</sub> emissions. Emissions are estimated based on the current power usage and a emission factor that gives equivalent grams of CO<sub>2</sub> power consumed. Currently, a [real time emission factor](https://www.rte-france.com/en/eco2mix/co2-emissions) is implemented for France and for the rest a constant configurable factor of 475 gCO<sub>2</sub>.eq/kWh is used.
Additionally, the extension is capable of estimating equivalent CO<sub>2</sub> emissions. Emissions are estimated based on the current power usage and a emission factor that gives equivalent grams of CO<sub>2</sub> power consumed. Currently, a [real time emission factor](https://www.rte-france.com/en/eco2mix/co2-emissions) is implemented for France and for the rest a constant configurable [factor](https://arxiv.org/pdf/2306.08323.pdf) of 475 gCO<sub>2</sub>.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.

Expand Down Expand Up @@ -64,7 +64,7 @@ By default `process` scope is used. The user can change it by CLI flag `--PowerU

### Frontend extension config

![Frontend extension settings](./doc/frontend-settings.png)
![Frontend extension settings](https://raw.githubusercontent.com/mahendrapaipuri/jupyter-power-usage/main/doc/frontend-settings.png)

The frontend extension settings can be accessed by `Settings -> Advanced Settings -> Power Usage Monitor` in JupyterLab. Important settings are:

Expand Down Expand Up @@ -92,3 +92,11 @@ pip uninstall jupyter_power_usage
```

This will uninstall python package and all the frontend related assets.

## Troubleshooting

- If 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.
8 changes: 4 additions & 4 deletions binder/environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: jupyter-resource-usage
channels:
- conda-forge
- conda-forge
dependencies:
- python=3
- jupyterlab=3
- nodejs=18
- python=3
- jupyterlab=3
- nodejs=18
Loading

0 comments on commit d8fc444

Please sign in to comment.