dabreegster / odjitter

Disaggregate zone-based origin/destination data to specific points
Apache License 2.0
12 stars 6 forks source link

Make it easier to run odjitter #48

Open Robinlovelace opened 1 year ago

Robinlovelace commented 1 year ago

Currently you need to compile the Rust code to install it.

I think that creating a Docker image and possibly and .devcontainer also could make running the code in here more accessible. Heads-up @EmmaVinterATE and Dustin (who will probably be notified of this as it's on his account : )

dabreegster commented 1 year ago

What OS are y'all using? It also wouldn't be hard to use GH actions to build a single-file exe / runnable file. (But also, check that permissions on your laptops are OK with unsigned exes before we do this.)

Also happy to have a Docker image; building it into an image should be very easy, plenty of examples online to copy.

Robinlovelace commented 1 year ago

Docker image probably easier because even if we have an executable I think we'll be unable to run it. For work laptops that means Windows.

dabreegster commented 1 year ago

The example starting from "Containerising a Rust program" at https://collabnix.com/getting-started-with-rust-and-docker/ should work fine. I've not used Docker from Windows before; can you run containers based on Linux images? Apparently you need Docker Desktop with WSL support or something like that -- is that already working?

Robinlovelace commented 1 year ago

The example starting from "Containerising a Rust program" at https://collabnix.com/getting-started-with-rust-and-docker/ should work fine. I've not used Docker from Windows before; can you run containers based on Linux images? Apparently you need Docker Desktop with WSL support or something like that -- is that already working?

Yes we have Docker installed. I can confirm that Linux-based images work fine from my Windows machines. Works imperfectly with some issues around firewall when not in office but we have support : )

dabreegster commented 1 year ago

fe8c1773790451f1e0ca7337d67f93c46db04ced adds a dockerfile, and I've published to dockerhub. docker run -t abstreet/odjitter help to get started. Robin identified that calling from R will still take a bit of thought. Either there can be another Docker image that also contains R, or the R library can optionally call that docker run command instead of assuming a local installation of the binary. Docker takes flags like --mount type=bind,source=pwd/data,target=/elevation/data to expose directories to the Docker image for reading/writing; the R interface could set those as needed.

Robinlovelace commented 1 year ago

Just tested another approach which works nicely: install Rust and odjitter in a post image download step, should work on most Linux based images (most images):

image

See files in the .devcontainer folder in https://github.com/nptscot/npt/pull/193/files for context, unfortunately it seems that GCP/Google does not natively support the .devcontainer specification, as far as I can tell, right?

Robinlovelace commented 1 year ago

Next step on this: add docker argument to R function odjitter().