Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINTENANCE] Ajout de l'évaluation de performance des routes dans GeoNature #2896

Merged
merged 27 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c1f770f
add code to benchmark
jacquesfize Feb 6, 2024
a09f772
create an object TestBenchmark + add docstring
jacquesfize Feb 6, 2024
a82c66d
add ci for eval perf + add requirements to setup.py
jacquesfize Feb 6, 2024
4d2e163
feat(benchmark): add sqlalchemy query profiling
VincentCauchois Feb 6, 2024
1a8e01e
fix(ci): update versions for github workflow pytestperf
jacquesfize Feb 6, 2024
f1d39ef
add new benchmark test
jacquesfize Feb 19, 2024
af9d59e
add tests for synthese + separate classes in different files + separa…
jacquesfize Feb 22, 2024
476259d
fix docstring + delete unused variable
jacquesfize Feb 22, 2024
f38036e
Change benchmark data (work with ecrin data)
jacquesfize Mar 4, 2024
2220699
add user to test blurring performance
jacquesfize Mar 4, 2024
ba5c1a1
add performance test of occhab
jacquesfize Mar 4, 2024
f44abbe
add performance for occtax
jacquesfize Mar 4, 2024
f8c0be6
add performance test in synthese with blurring
jacquesfize Mar 4, 2024
c064b93
update ci to run benchmarks only in eval_perf
jacquesfize Mar 5, 2024
68838f9
add user with blurring in fixture
jacquesfize Mar 5, 2024
d23755f
add blurring to synthese benchmark
jacquesfize Mar 5, 2024
c069f3d
add method to include blurring test automatically
jacquesfize Mar 5, 2024
0bb6b19
add group to benchmark
jacquesfize Mar 5, 2024
acbfeb8
add status and taxons export to synthese benchmark
jacquesfize Mar 7, 2024
9c4ad84
rename test in occtax
jacquesfize Mar 7, 2024
f43ef69
add benchmark test for gn_meta
jacquesfize Mar 7, 2024
c576bcf
add export habitat benchmark test
jacquesfize Mar 7, 2024
9567634
Feat(CI) run on self hosted
Pierre-Narcisi Mar 26, 2024
295c628
Feat(CI) read eval.yml
Pierre-Narcisi Mar 26, 2024
96a8156
(test,eval_perf)add sql log filename in pytest
jacquesfize Mar 26, 2024
55b78f8
(test,eval perf) enable sql log to all benchmark
jacquesfize Mar 26, 2024
e77cd83
feat(eval-perf,sql log): now include endpoint
jacquesfize Mar 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/eval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jobs:
strategy:
fail-fast: false
matrix:
debian-version: ["11", "12"]
debian-version: ['11', '12']
include:
- debian-version: "11"
python-version: "3.9"
postgres-version: "13"
postgis-version: "3.2"
- debian-version: "12"
python-version: "3.11"
postgres-version: "15"
postgis-version: "3.3"
- debian-version: '11'
python-version: '3.9'
postgres-version: '13'
postgis-version: '3.2'
- debian-version: '12'
python-version: '3.11'
postgres-version: '15'
postgis-version: '3.3'

name: Debian ${{ matrix.debian-version }}

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache: 'pip'
- name: Install GDAL
run: |
sudo apt update
Expand Down
137 changes: 137 additions & 0 deletions .github/workflows/eval_perf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Performance Evaluation
on:
workflow_dispatch:

jobs:
build:
runs-on: self-hosted

strategy:
fail-fast: false
matrix:
debian-version: ["11", "12"]
include:
- debian-version: "11"
python-version: "3.9"
postgres-version: "13"
postgis-version: "3.2"
- debian-version: "12"
python-version: "3.11"
postgres-version: "15"
postgis-version: "3.3"

name: Debian ${{ matrix.debian-version }}

services:
postgres:
image: postgis/postgis:${{ matrix.postgres-version }}-${{ matrix.postgis-version }}
env:
POSTGRES_DB: geonature2db
POSTGRES_PASSWORD: geonatpasswd
POSTGRES_USER: geonatadmin
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Add database extensions
run: |
psql -h localhost -U geonatadmin -d geonature2db -f install/assets/db/add_pg_extensions.sql
env:
PGPASSWORD: geonatpasswd
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install GDAL
run: |
sudo apt update
sudo apt install -y libgdal-dev
- name: Install dependencies
if: github.base_ref == 'master'
run: |
echo 'Installation des requirements de prod'
python -m pip install --upgrade pip
python -m pip install \
-e ..[tests] \
-r requirements.txt
working-directory: ./backend
- name: Install dependencies
if: github.base_ref != 'master'
run: |
echo 'Installation des requirements de dev'
python -m pip install --upgrade pip
python -m pip install \
-e ..[tests] \
-r requirements-dev.in
working-directory: ./backend
- name: Show database branches and dependencies
run: |
geonature db status --dependencies
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
# - name: Restore database
# run: |
# # wget https://www.dropbox.com/scl/fi/17gsthsftfg59mxwmbbre/export_geonature_10000.zip?rlkey=33choleag4xw60wadm802c3oh&dl=1 -O 10kDump.zip
# # unzip 10kDump.zip
# wget https://www.dropbox.com/scl/fi/jjkxyg120bxc0dp8uy8kq/300KDump.sql?rlkey=tyuk2svitcb9nyshn7r09yo7b&dl=1 -O 300KDump.sql
# ls
# psql -h localhost -U geonatadmin -d geonature2db -f 300KDump.sql
# env:
# PGPASSWORD: geonatpasswd
- name: Install database
run: |
install/03b_populate_db.sh
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
srid_local: 2154
install_bdc_statuts: true
add_sample_data: true
install_sig_layers: true
install_grid_layer_5: true
install_grid_layer_10: true
install_ref_sensitivity: true
- name: Show database status
run: |
geonature db status
env:
GEONATURE_CONFIG_FILE: config/test_config.toml

- name: Install core modules backend
run: |
pip install -e contrib/occtax
pip install -e contrib/gn_module_occhab
pip install -e contrib/gn_module_validation
- name: Show database status
run: |
geonature db status
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Install core modules database
run: |
geonature upgrade-modules-db
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Show database status
run: |
geonature db status --dependencies
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Load benchmark stable data
run: |
wget https://geonature.fr/data/benchmark_history/benchmark_stable.json -O benchmark_stable.json

- name: Compare performance to stable data
run: |
pytest --benchmark-only --benchmark-compare-fail="mean:0.1" --benchmark-compare=benchmark_stable.json
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
# https://stackoverflow.com/a/64126737 For posting results on GitHub Pull Requests
22 changes: 11 additions & 11 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
strategy:
fail-fast: false
matrix:
debian-version: ["11", "12"]
debian-version: ['11', '12']
include:
- debian-version: "11"
python-version: "3.9"
postgres-version: "13"
postgis-version: "3.2"
- debian-version: "12"
python-version: "3.11"
postgres-version: "15"
postgis-version: "3.3"
- debian-version: '11'
python-version: '3.9'
postgres-version: '13'
postgis-version: '3.2'
- debian-version: '12'
python-version: '3.11'
postgres-version: '15'
postgis-version: '3.3'

name: Debian ${{ matrix.debian-version }}

Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache: 'pip'
- name: Install GDAL
run: |
sudo apt update
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Test with pytest
run: |
pytest -v --cov --cov-report xml
pytest -v --cov --cov-report xml --benchmark-skip
env:
GEONATURE_CONFIG_FILE: config/test_config.toml
- name: Upload coverage to Codecov
Expand Down
5 changes: 5 additions & 0 deletions backend/geonature/tests/benchmarks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Import required for CLater class when using eval()
from flask import url_for
from .benchmark_data import *
from geonature.core.gn_synthese.models import Synthese
from sqlalchemy import select
Loading
Loading