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

Read TransportNetworks directly from kryo files #367

Open
owenam opened this issue Oct 12, 2023 · 5 comments
Open

Read TransportNetworks directly from kryo files #367

owenam opened this issue Oct 12, 2023 · 5 comments
Labels
enhancement New feature or request reminder something to do one day (but not today)

Comments

@owenam
Copy link

owenam commented Oct 12, 2023

Currently, r5py builds a (python+java)TransportNetwork from a directory containing OSM and GTFS files, or from explictly-named OSM and GTFS files. These networks have to be rebuilt every time the same inputs are used. R5 provides methods for using Kryo to serialize/deserialize (java)TransportNetwork objects to/from arbitrary individual files, so that the network can be reloaded in the future without having to rebuild it from the OSM and GTFS inputs. Making use of this interface would be a big gain in flexibility for r5py.

The serialization/deserialization interface is in com.conveyal.r5.kyro.KryoNetworkSerializer.

I propose implementing this in (python)TransportNetwork by:

  • Moving most existing TransportNetwork.__init__() code to a new TransportNetwork.build_from_sources() method
  • Adding a TransportNetwork.load_network() method to read from a Kryo-serialized file
  • Rewriting TransportNetwork.__init__() to parse an input list of files or directory to decide which of the methods to use

There's a variety of reasonable ways to name/arrange this all.

r5r does something similar via a Java implementation in org.ipea.r5r.Network.NetworkBuilder

This is something that I'd be happy to prototype following some discussion of naming and organization.

@owenam
Copy link
Author

owenam commented Oct 13, 2023

The discussion over at r5r in ipeaGIT/r5r#350 suggests that this might be entangled with ongoing JDK and Kryo version updates in R5: conveyal/r5#760

@christophfink
Copy link
Member

The discussion over at r5r in ipeaGIT/r5r#350 suggests that this might be entangled with ongoing JDK and Kryo version updates in R5: conveyal/r5#760

That would be fantastic, some of the library versions used have been deprecated for a while now

@owenam
Copy link
Author

owenam commented Nov 20, 2023

We're finding it easy to work with the current 'build-every-time' approach, so I'm not going to pursue this in the short term. Because of the interaction with Kryo and JDK version, it seems like it will be a good time to revisit once R5 and r5py have digested the update from Java 11 to Java 21 which has been merged into R5's dev branch.

@christophfink christophfink added enhancement New feature or request reminder something to do one day (but not today) labels Nov 22, 2023
@christophfink christophfink added this to the More in the future milestone Nov 22, 2023
@abyrd
Copy link

abyrd commented Nov 29, 2023

Hi everyone! We thought you might be interested in this: https://github.com/conveyal/r5/releases/tag/v7.0

@christophfink
Copy link
Member

Hi everyone! We thought you might be interested in this: https://github.com/conveyal/r5/releases/tag/v7.0

Hi! We actually bumped the R5 version in main, already (PR #385), so next r5py release is definitely building up on v7.0 :) Thanks for the heads-up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request reminder something to do one day (but not today)
Projects
None yet
Development

No branches or pull requests

3 participants