Giter Club home page Giter Club logo

Comments (7)

xamanu avatar xamanu commented on May 26, 2024

This might be easy to do within refactoring OsmHelper #31

from osm2gtfs.

xamanu avatar xamanu commented on May 26, 2024

Would it make sense to save to files after queries and cache again after building the structure into the RouteMaster, Route and Stop objects? Or should we only cache right after the query? Or should we only cache when everything is built into the objects?

from osm2gtfs.

grote avatar grote commented on May 26, 2024

Since disk access is a lot faster than network access, we should cache as often as possible.

Also, we might be able to use the latest change of the relation/node to decide whether we need to refresh the cached data.

I will push a commit soon that adds the first piece to that puzzle. Hopefully, that will allow us to build up the cache faster in several steps when tweaking the queries.

from osm2gtfs.

xamanu avatar xamanu commented on May 26, 2024

Just a note/though: Caching should probably be handled through a separate class and not inside the OsmHelper itself. It has not necessarily something to do with OSM data retrieval, so why should it live there? A separate class would make more sense and we'd be prepared for the future in case caching becomes more advanced.

from osm2gtfs.

xamanu avatar xamanu commented on May 26, 2024

With the latest commit caching now lives in a separate Cache class. We also cache after every find_best_name_for_unnamed_stop call. The only thing that is missing for this issue, is to actually cache queried raw result sets right after querying. But this doesn't seem to be possible, because Python can't pickle lambda functions:

If doing:

# Obtain raw data about routes from OpenStreetMap
result = self._query_routes()
# Cache and return whole result set
Cache.write_data('routes_raw', result)

I get an ugly error:

pickle.PicklingError: Can't pickle <function <lambda> at 0x7ff255d0e320>: it's not found as overpy <lambda>

Any solution to this? Or shall we close this issue as resolved.

from osm2gtfs.

grote avatar grote commented on May 26, 2024

Is it a big problem to not cache query data? Isn't it sufficient to just cache the resulting objects? Creating them shouldn't take too long, right?

from osm2gtfs.

xamanu avatar xamanu commented on May 26, 2024

It's fine. Just for development purposes it would have been nice to cache before. But it's not that important. I was just mentioning it to explain that the initial request was not completely realizable. Closing here then.

from osm2gtfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.