kausaltech / reina-model

Agent-based simulation model for COVID-19 spread in society and patient outcomes
https://reina.kausal.tech/
GNU Affero General Public License v3.0
30 stars 14 forks source link

Make it possible to run Reina with Docker #17

Closed jukvalim closed 4 years ago

jukvalim commented 4 years ago

This pull request adds support for running Reina with Docker. This should make it more convenient to run, particularly for people on Windows and Macs.

The one part that doesn't work is showing the actual Dash graphs, at localhost:8123. I have no idea why that is, the behaviour in web console seems to be the same as here: https://korona.kausal.tech/sim/ . Any idea what may be the cause?

juyrjola commented 4 years ago

Thanks! The reason for the lack of results in the Dash UI is most likely due to the pretty hacky way the Flask process receives the computation results from the spawned simulation process. It currently uses the cache functionality as a poor man's IPC, and the cache uses Redis as the backend. If a Redis backend is not configured (REDIS_URL is not set), we default to the simple cache type, which might be just an in-process memory store.

juyrjola commented 4 years ago

It would be good to implement the IPC better, or figure out why using a computation thread (instead of a process) prevents live simulation updates from being sent to the browser. Might be something to do with the computation thread hoarding the Python GIL, but I haven't had time to dig into it. :disappointed: Help would be much appreciated!

jukvalim commented 4 years ago

@juyrjola Working with Python threading issues sounds like a fun way to spend a few evenings. 😁 But maybe there's no need for it. I added a docker-compose file so that Redis will automatically run together with Reina. Now the visualizations work nicely. Pull request here: https://github.com/kausaltech/reina-model/pull/18