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

feat: c2corg#1067 add public transport information in routes #1797

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Nayor
Copy link
Contributor

@Nayor Nayor commented May 14, 2024

No description provided.

@Nayor Nayor force-pushed the feat/#1067-add-public-transport-information-in-routes branch from 3dcb75f to 7198562 Compare May 14, 2024 13:11
@eddy-geek
Copy link

xref #1067 and c2corg/c2c_ui#3936 for frontend

@@ -282,3 +312,206 @@ def set_title_prefix_for_ids(ids, title):
"""
DBSession.query(RouteLocale).filter(RouteLocale.id.in_(ids)). \
update({RouteLocale.title_prefix: title}, synchronize_session=False)


def update_all_pt_rating(waypoint_extrapolation=True):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit worried about using the ORM for such a giant query... best way to run this would be in batches ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddy-geek
The first request runs in 3209.054 ms on my laptop
The whole process is done in a few minutes and is supposed to be used only once, afterwards the informations are supposed to be automaticaly updated on route/waypoint creation/updates

With python log level = INFO and postgresql log level to all, the whole process took about 2-3 hours on my laptop and generates huge amount of logs (since that for each route, every linked waypoints are read and the route updated)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be the best is to not expose this function to the REST API and run it with a command line ? So only devs can run it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you run your tests on the full production database?

if it's just a one-time migration then yes we should not leave it in the API, but I guess it's ok to leave it as-is for now and remove the API part after we're done with the initial migration

Copy link
Contributor Author

@Nayor Nayor Jul 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have run the tests on the docker's image data, I don't have access to the production data

The other way to make the migration is to call the function using a python command

@Nayor Nayor force-pushed the feat/#1067-add-public-transport-information-in-routes branch from 7198562 to 51bd9c6 Compare May 15, 2024 17:44
@Nayor Nayor force-pushed the feat/#1067-add-public-transport-information-in-routes branch from 51bd9c6 to af19ddd Compare May 15, 2024 19:15
@Nayor Nayor changed the title Feat/#1067 add public transport information in routes feat: c2corg#1067 add public transport information in routes May 15, 2024
Copy link

@eddy-geek eddy-geek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants