spatialmodel / inmap

InMAP reduced-form air quality model for fine particulate matter (PM2.5)
GNU General Public License v3.0
59 stars 42 forks source link

draft, inmaputil: Modifying inmap.go to route certain outputs to Gobra #35

Closed khoin closed 6 years ago

khoin commented 6 years ago

Hi Chris,

This is the way I'd route messages from InMap to Gobra (web interface).

The browser isn't happy with it being bombarded with thousands of messages, so I couldn't add CobraCommand.OutOrStdout() to mw MultiWriter (in line 131 of inmaputil/inmap.go).

However, I routed some of the messages, and it was okay with that. Here's a screenshot showing the percentage change since last convergence check and the adding grid cells... but not the iteration xxx walltime=[...].

Hope this makes sense. I figured you would know better about which messages you'd prefer to send to the browser as well, so this PR is merely a draft.


I am not exactly sure where to put the documentation for this because it's scattered everywhere, but here are different ways to print a message to the browser:

Let me know if anything is unclear.

image

ctessum commented 6 years ago

Thanks, Koi. I think it's okay to send all of the log messages to the browser. It usually won't be a problem because under normal usage the model runs much more slowly than in the test cases, and if it continues to be a problem, we can just set it up to write log messages less often.

So I think what we can do is this line, we can add cmd.OutOrStdout to the list of writers that are being logged to, and remove os.Stdout so that we're not logging the messages to the console twice.

Also, the the eval subdirectory is failing to compile, which I think you can fix by adding an empty cmd argument to the Run() functions in that directory.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.002%) to 83.251% when pulling fe1ad7a0d96522743dbbce7ff21c5783b079a888 on khoin:newGobra into d3bb20e4c5de2c4f02d338cf24125e39f8590a38 on spatialmodel:master.

khoin commented 6 years ago

Hi Chris,

I've routed the output directly to the Cobra.Command writer now. I've also fixed for the tests in eval/. The tests pass with Travis CI but fails on my laptop Windows computer for some reasons. I don't think I'll be able to track it down.

I thinks this should be good now. I'm not sure if this catches all outputs from the program, but I don't think I can track down all the output messages in time either.

ctessum commented 6 years ago

Thanks, Koi. This looks good. Just one thing: you need to run dep ensure --update github.com/ctessum/gobra and then commit the results to make sure the most recent version of gobra is getting used. If you don't have the correct versions of the dependencies installed (by using dep ensure) on your laptop that could also be what's causing the tests to fail for you.

khoin commented 6 years ago

updated gopkg.

ctessum commented 6 years ago

Thanks!