diff --git a/.github/workflows/eval_perf.yml b/.github/workflows/eval_perf.yml index a0680b35e9..f9f5134659 100644 --- a/.github/workflows/eval_perf.yml +++ b/.github/workflows/eval_perf.yml @@ -5,7 +5,7 @@ on: jobs: build: - runs-on: self-hosted + runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/backend/geonature/tests/benchmark_data.py b/backend/geonature/tests/benchmark_data.py new file mode 100644 index 0000000000..d8327007ab --- /dev/null +++ b/backend/geonature/tests/benchmark_data.py @@ -0,0 +1,561 @@ +benchmark_synthese_intersection_data_test_bbox = { + "modif_since_validation": False, + "geoIntersection": { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [6.363466, 44.754607], + [6.363466, 44.892886], + [6.519971, 44.892886], + [6.519971, 44.754607], + [6.363466, 44.754607], + ] + ], + }, + }, +} + +benchmark_synthese_intersection_data_test_complex_polygon = { + "modif_since_validation": False, + "geoIntersection": { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [6.373232, 44.894802], + [6.363622, 44.871455], + [6.352639, 44.846151], + [6.356758, 44.843231], + [6.381469, 44.838363], + [6.381572, 44.833973], + [6.376767, 44.817419], + [6.367158, 44.814984], + [6.353429, 44.814497], + [6.352743, 44.800373], + [6.365098, 44.792579], + [6.374022, 44.794527], + [6.377454, 44.783322], + [6.369903, 44.772114], + [6.334895, 44.773089], + [6.321167, 44.774063], + [6.311557, 44.764316], + [6.345192, 44.75603], + [6.359607, 44.746279], + [6.356175, 44.739453], + [6.37814, 44.729213], + [6.41864, 44.755055], + [6.438546, 44.753105], + [6.44541, 44.741404], + [6.463944, 44.744329], + [6.419326, 44.723848], + [6.439919, 44.714092], + [6.504443, 44.726774], + [6.549061, 44.755542], + [6.573772, 44.783809], + [6.540137, 44.816932], + [6.55112, 44.825209], + [6.542883, 44.847115], + [6.569654, 44.861228], + [6.547001, 44.885552], + [6.549061, 44.89771], + [6.510621, 44.922019], + [6.500324, 44.909379], + [6.494833, 44.884093], + [6.470122, 44.882633], + [6.461198, 44.904517], + [6.480418, 44.931253], + [6.476986, 44.946803], + [6.400106, 44.940486], + [6.41864, 44.919588], + [6.42619, 44.915213], + [6.411089, 44.890902], + [6.38775, 44.922991], + [6.340387, 44.929309], + [6.306752, 44.91181], + [6.286846, 44.896737], + [6.304006, 44.887497], + [6.343819, 44.885552], + [6.36098, 44.892847], + [6.373232, 44.894802], + ] + ], + }, + }, +} + +benchmark_synthese_intersection_data_test_commune = { + "modif_since_validation": False, + "area_COM": [28612], +} + +benchmark_synthese_with_tree_taxon = { + "modif_since_validation": False, + "cd_ref_parent": [ + 183787, + 183767, + 183839, + 183840, + 183843, + 183874, + 184358, + 184357, + 184355, + 184354, + 184353, + 184367, + 184376, + 927956, + 200726, + 184350, + 184351, + 184366, + 184363, + 184362, + 184360, + 184359, + 184377, + 184379, + 184374, + 184371, + 184369, + 184368, + 184381, + 184393, + 184391, + 184390, + 184385, + 184387, + 184388, + 184378, + 184438, + 184449, + 184450, + 184493, + 1007942, + 184501, + 184486, + 184488, + 184491, + 184499, + 184492, + 184494, + 200765, + 184737, + 184740, + 184743, + 184752, + 184756, + 184762, + 184766, + 184767, + 184768, + 184771, + 184773, + 184775, + 184776, + 184772, + 184615, + 184616, + 184618, + 184630, + 184643, + 188023, + 200773, + 793340, + 184644, + 184646, + 184649, + 184650, + 184653, + 184658, + 184660, + 184662, + 184666, + 184667, + 184668, + 184670, + 184671, + 184672, + 184674, + 184676, + 184680, + 184682, + 184684, + 184685, + 184689, + 184694, + 184696, + 184699, + 184701, + 184702, + 184703, + 184706, + 184708, + 184709, + 184711, + 184712, + 184714, + 184715, + 184718, + 184720, + 184728, + 184732, + 184734, + 184735, + 184781, + 184791, + 184802, + 184801, + 184890, + 184808, + 184810, + 184815, + 184831, + 184836, + 184838, + 184839, + 184843, + 184847, + 184848, + 184852, + 184853, + 184855, + 184862, + 184865, + 184867, + 184870, + 184872, + 184874, + 184877, + 184879, + 184880, + 184882, + 184883, + 184885, + 184888, + 184889, + 184891, + 184892, + 184894, + 184896, + 184900, + 184907, + 184927, + 184944, + 184947, + 184948, + 184949, + 184950, + 184952, + 839211, + 184961, + 184976, + 185027, + 185028, + 185030, + 185033, + 185043, + 185046, + 185051, + 185064, + 185075, + 185076, + 185077, + 185078, + 185023, + 185081, + 185082, + 185084, + 185085, + 185088, + 185090, + 185124, + 185080, + 185025, + 645275, + 184994, + 834425, + 839203, + 938486, + 184992, + 184988, + 184984, + 184983, + 938483, + 938487, + 185012, + 185204, + 185211, + 188009, + 827922, + 728177, + 187977, + 827924, + 827925, + 714463, + 185129, + 939246, + 185130, + 185131, + 185133, + 185150, + 185157, + 185162, + 185171, + 185188, + 185189, + 185190, + 185193, + 185194, + 185197, + 714275, + 648561, + 610362, + 602182, + 200681, + 185216, + 185220, + 185223, + 185224, + 185226, + 185230, + 185232, + 185234, + 185240, + 185242, + 185244, + 185245, + 185247, + 185249, + 185251, + 185253, + 185254, + 185257, + 185259, + 185263, + 185266, + 185268, + 185270, + 185273, + 185274, + 185276, + 185278, + 185280, + 185285, + 185286, + 185287, + 185290, + 185291, + 185292, + 185297, + 185302, + 185307, + 185308, + 185309, + 185313, + 185322, + 185323, + 185324, + 185327, + 185330, + 714314, + 185334, + 185352, + 185346, + 185347, + 185351, + 185369, + 185372, + 185371, + 185365, + 185364, + 185362, + 185360, + 185359, + 185374, + 185378, + 185388, + 185389, + 185399, + 437022, + 185383, + 185385, + 185468, + 185467, + 185471, + 185472, + 185473, + 185517, + 185566, + 185554, + 185568, + 185557, + 185582, + 185580, + 185578, + 528744, + 185401, + 185590, + 185593, + 185599, + 185596, + 185594, + 185602, + 185604, + 185621, + 185635, + 185652, + 185651, + 185649, + 185669, + 185674, + 186286, + 699191, + 618462, + 186293, + 186292, + 186283, + 185770, + 185781, + 185830, + 185832, + 185896, + 185900, + 185760, + 905695, + 904968, + 827284, + 825345, + 185967, + 185979, + 186008, + 186010, + 186012, + 186000, + 186006, + 185998, + 186058, + 186067, + 186062, + 186076, + 186091, + 186084, + 186094, + 186101, + 885360, + 885396, + 885400, + 885430, + 186121, + 186117, + 186115, + 186110, + 186135, + 186107, + 186108, + 186137, + 186139, + 186141, + 186145, + 186146, + 186148, + 186152, + 186154, + 186158, + 186160, + 186130, + 186129, + 186124, + 186122, + 828783, + 186168, + 186178, + 186176, + 186027, + 186047, + 186021, + 186019, + 186038, + 186025, + 351923, + 186173, + 185985, + 186055, + 186053, + 185990, + 186221, + 186214, + 186223, + 186215, + 186238, + 186237, + 186239, + 699095, + 186245, + 186257, + 186259, + 655502, + 199825, + 443494, + 655482, + 186210, + 186209, + 186211, + 186241, + 186243, + 186242, + 199959, + 444434, + 185954, + 185951, + 185946, + 185960, + 186330, + 933748, + 186337, + 186332, + 186374, + 186376, + 186365, + 186377, + 186346, + 186409, + 186380, + 186383, + 186386, + 186388, + 186390, + 186391, + 186392, + 186393, + 186396, + 186399, + 186400, + 186401, + 186404, + 186406, + 186407, + 186415, + 186418, + 186422, + 186423, + 186425, + 186426, + 186430, + 187541, + 851431, + 851437, + 851464, + 186356, + 810391, + 699677, + 186353, + 186369, + 186997, + ], +} diff --git a/backend/geonature/tests/test_benchmark.py b/backend/geonature/tests/test_benchmark.py index 4ebdeb1d4c..f5166c4ab4 100644 --- a/backend/geonature/tests/test_benchmark.py +++ b/backend/geonature/tests/test_benchmark.py @@ -5,6 +5,8 @@ from flask import url_for import pytest +from .benchmark_data import * + class GetLatter: def __init__(self, value) -> None: @@ -133,19 +135,53 @@ def after_cursor_execute(conn, cursor, statement, parameters, context, executema event.listen(db.engine, "after_cursor_execute", after_cursor_execute) +# r = self.client.post(url_for("gn_synthese.get_observations_for_web"), json=filters) tests = [ - # BenchmarkTest( - # GetLatter("self.client.get"), - # "get_station", - # [GetLatter("""url_for("occhab.get_station", id_station=8)""")], - # dict(user_profile="user", fixture=[stations]), - # ), + BenchmarkTest( + GetLatter("self.client.get"), + "get_station", + [GetLatter("""url_for("occhab.get_station", id_station=8)""")], + dict(user_profile="user", fixture=[stations]), + ), BenchmarkTest( GetLatter("self.client.get"), "get_default_nomenclatures", [GetLatter("""url_for("gn_synthese.getDefaultsNomenclatures")""")], dict(user_profile="self_user"), ), + BenchmarkTest( + GetLatter("self.client.post"), + "synthese_with_geometry_bbox", + [GetLatter("""url_for("gn_synthese.get_observations_for_web")""")], + dict(user_profile="admin_user", json=benchmark_synthese_intersection_data_test_bbox), + ), + BenchmarkTest( + GetLatter("self.client.post"), + "synthese_with_geometry_complex_poly", + [GetLatter("""url_for("gn_synthese.get_observations_for_web")""")], + dict( + user_profile="admin_user", + json=benchmark_synthese_intersection_data_test_complex_polygon, + ), + ), + BenchmarkTest( + GetLatter("self.client.post"), + "synthese_with_commune", + [GetLatter("""url_for("gn_synthese.get_observations_for_web")""")], + dict( + user_profile="admin_user", + json=benchmark_synthese_intersection_data_test_commune, + ), + ), + BenchmarkTest( + GetLatter("self.client.post"), + "synthese_with_up_tree_taxon", + [GetLatter("""url_for("gn_synthese.get_observations_for_web")""")], + dict( + user_profile="admin_user", + json=benchmark_synthese_with_tree_taxon, + ), + ), ]