-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #670 from sfu-db/benchmark_action
test(eda): add performance test
- Loading branch information
Showing
5 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Performance Benchmarks | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
benchmark: | ||
name: ${{ matrix.os }} x ${{ matrix.python }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python: ["3.7"] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install poetry | ||
poetry config virtualenvs.in-project true | ||
poetry install | ||
poetry run pip install pytest-benchmark | ||
- name: Run benchmark | ||
run: poetry run pytest dataprep/tests/benchmarks/eda.py --benchmark-json benchmark.json | ||
|
||
- name: Show benchmark result for pull request | ||
if: ${{ github.event_name == 'pull_request'}} | ||
uses: rhysd/github-action-benchmark@v1 | ||
with: | ||
name: DataPrep.EDA Benchmarks | ||
tool: "pytest" | ||
output-file-path: benchmark.json | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
auto-push: false | ||
save-data-file: false | ||
fail-threshold: "200%" | ||
comment-always: true | ||
fail-on-alert: true | ||
|
||
- name: Store benchmark result for push operator | ||
if: ${{ github.event_name == 'push'}} | ||
uses: rhysd/github-action-benchmark@v1 | ||
with: | ||
name: DataPrep.EDA Benchmarks | ||
tool: "pytest" | ||
output-file-path: benchmark.json | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
auto-push: true | ||
fail-threshold: "200%" | ||
comment-always: true | ||
fail-on-alert: true |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" | ||
This module is used for performance testing and generating plot in github action. | ||
""" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
This module is for performance testing of EDA module in github action. | ||
""" | ||
from functools import partial | ||
import pandas as pd | ||
from typing import Any | ||
from ...datasets import load_dataset | ||
from ...eda import create_report | ||
|
||
|
||
def report_func(df: pd.DataFrame, **kwargs: Any) -> None: | ||
""" | ||
Create report function, used for performance testing. | ||
""" | ||
create_report(df, **kwargs) | ||
|
||
|
||
def test_create_report(benchmark: Any) -> None: | ||
""" | ||
Performance test of create report on titanic dataset. | ||
""" | ||
df = load_dataset("titanic") | ||
benchmark(partial(report_func), df) |