-
Notifications
You must be signed in to change notification settings - Fork 1
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
Create results folder and save log files to it #359
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #359 +/- ##
==========================================
+ Coverage 95.15% 95.22% +0.07%
==========================================
Files 30 31 +1
Lines 3548 3604 +56
Branches 3548 3604 +56
==========================================
+ Hits 3376 3432 +56
- Misses 90 92 +2
+ Partials 82 80 -2 ☔ View full report in Codecov by Sentry. |
325711a
to
1fb33fb
Compare
PS -- Don't feel you have to scrutinise the logging-specific parts of this code particularly hard unless you want to! It basically just does what it did before except now also writes a couple of files too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for now, with the caveats you've mentioned
Other points/suggestions:
- I think eventually we'll want to make the results path configurable, either via an option in the settings file or a command-line argument
- MUSE1 has a
replace
parameter in the settings file to determine whether existing files in the results path should be overwritten, or an error raised. We could consider something similar
0880250
to
6f3589c
Compare
Description
We'll need somewhere to save the results for when we want to write the various output files, so I thought it would be worth writing the code to create the output folder now. It seemed a bit weird to just make an empty folder though, so I did #110 at the same time, so we at least have log files in there for now. The logging code has ended up a bit convoluted now (because we've chosen a complex design), but hopefully it's not too messy. Writing tests proved tricky so I didn't bother 😉. I've done manual testing of the various parts though.
Now we have:
muse2_error.log
filemuse2_info.log
fileThe user can still configure the log level via
settings.toml
or an environment variable. However, this does not affect the log files, as I figured we want to capture everything in those. There is an exception: if the user sets the log level to be more verbose than the default (e.g. they set it todebug
) thenmuse2_info.log
will contain these extra messages too.Closes #110.
Limitations
For now, if you run the same model twice, it'll use the same output folder for both and will append to the existing log files for the second run. This is probably fine for log files, but when we come to writing data we won't want to overwrite existing CSV files, so we'll want to do something else (error if the folder exists append a number/timestamp etc.).
The integration test we have (
test_handle_run_command
incommand.rs
) will now also write these log files to the output folder when we run it. This isn't ideal, because we don't know what state that output folder will be in (it may already exist with log files). It would be better to create a temporary directory to save the log files to, but the current code doesn't allow that. We could refactor things, but I didn't want to muck about incommand.rs
too much as @Sahil590 is also working on it.I'll open issues for both of those things.
Type of change
Key checklist
$ cargo test
$ cargo doc
Further checks