OpenRailAssociation / osrd

An open source web application for railway infrastructure design, capacity analysis, timetabling and simulation
https://osrd.fr
GNU Lesser General Public License v3.0
419 stars 40 forks source link

Fix editoast batch simulation reducing DB queries #7931

Closed flomonster closed 1 week ago

flomonster commented 1 week ago

We reduce the number of queries executed by the batch simulation function. Previously, for N trains, we executed Nx4 postgres queries. Now we run ~4 batch queries.

close #7867

close #7907

[!NOTE] In my test in local the health check takes no more than 500ms to respond, compared with 6s before

Benchmark

I tested with a timetable of 823 trains

Before

Summary:

Project path:

After

Summary:

Project path:

codecov-commenter commented 1 week ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 18.42%. Comparing base (2c70a65) to head (e1cf1ac).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

:exclamation: There is a different number of reports uploaded between BASE (2c70a65) and HEAD (e1cf1ac). Click for more details.

HEAD has 1 upload less than BASE | Flag | BASE (2c70a65) | HEAD (e1cf1ac) | |------|------|------| |editoast|1|0|
Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #7931 +/- ## ============================================ - Coverage 28.35% 18.42% -9.93% Complexity 2059 2059 ============================================ Files 1269 994 -275 Lines 155395 126382 -29013 Branches 3055 3055 ============================================ - Hits 44059 23284 -20775 + Misses 109512 101274 -8238 Partials 1824 1824 ``` | [Flag](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/7931/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [core](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/7931/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `75.00% <ø> (ø)` | | | [editoast](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/7931/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `?` | | | [front](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/7931/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `9.95% <ø> (ø)` | | | [gateway](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/7931/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `2.34% <ø> (ø)` | | | [railjson_generator](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/7931/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `87.49% <ø> (ø)` | | | [tests](https://app.codecov.io/gh/OpenRailAssociation/osrd/pull/7931/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | `72.93% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.