Copy input files to output folder#1282
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1282 +/- ##
==========================================
- Coverage 89.79% 89.65% -0.14%
==========================================
Files 57 57
Lines 8211 8441 +230
Branches 8211 8441 +230
==========================================
+ Hits 7373 7568 +195
- Misses 542 565 +23
- Partials 296 308 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This is a good start! We'll want an ability to turn this off, i.e. a Once we've got this option, we should turn it off when generating the test data with |
|
@mjademitchell Side point, it would be worth running |
alexdewar
left a comment
There was a problem hiding this comment.
This looks great. V useful! I think it needs a couple of small tweaks, but otherwise all good.
When you run just regenerate_test_data now, you get all the input folders along with the test data. I think this is fine, but we don't want to commit these files, so we should add **/input/* to the tests/data/.gitignore file.
| } | ||
| /// Copy input files from the model directory to a subdirectory of the output directory | ||
| pub fn copy_input_files(model_dir: &Path, output_dir: &Path) -> Result<()> { | ||
| let input_copy_dir = output_dir.join("input"); |
There was a problem hiding this comment.
Could you also include the model name in the path, i.e. have the folder be {output_folder}/input/simple for the simple example? We get the name in this way in get_output_dir().
It would be nice to be able to run the model from the output folder, but if the folder is called input, MUSE2 will assume it's a model called input and write the output to muse2_results/input.
There was a problem hiding this comment.
It would be nice to be able to run the model from the output folder
Perhaps, but to be honest I can't see a good reason to ever want to do this! We already have the results right there so no need to run again, nor should people ever be directly changing these files to run the model in a slightly different way - if you wanted to do that then better to copy the files to a different path and run them from there...
There was a problem hiding this comment.
In fact, I would go one step further and ban running models in the muse2_results folder. I really don't think this is something we should be allowing/encouraging. For another PR though!
(Not opposed to the original suggestion of changing the path, I think that's fine but not necessarily essential)
There was a problem hiding this comment.
It would be nice to be able to run the model from the output folder
Perhaps, but to be honest I can't see a good reason to ever want to do this! We already have the results right there so no need to run again, nor should people ever be directly changing these files to run the model in a slightly different way - if you wanted to do that then better to copy the files to a different path and run them from there...
Agree that changing the model then running it would be bad! But it's legitimate to tell MUSE2 to run the model from that folder though, I think. You might want to do this if you're trying to reproduce the outputs of a model that someone has sent you, for example. I haven't opened an issue for it, but I've been thinking it might be neat to have a --reproduce option for the run command that tries to reproduce someone's results from an output folder (reusing some of the machinery we use for regression tests).
We could make the files readonly to stop users mucking about with them as discussed: #1283
There was a problem hiding this comment.
I haven't opened an issue for it, but I've been thinking it might be neat to have a
--reproduceoption for theruncommand that tries to reproduce someone's results from an output folder (reusing some of the machinery we use for regression tests).
I think that's a nice idea.
The other concern about running the input files from the results folder is that, since the name of the model will match the name of the results folder you're running it from, then if --overwrite is set to true, running this model will delete the original output files, which is probably not what you want! Further, it would delete the input files themselves so I think you wouldn't actually be able to do it unless we reorder the events in handle_run_command. You could get around this by setting --output-dir, but this is still quite a dangerous trap.
At least with the --reproduce option we could ensure that this doesn't happen
@alexdewar I had the same comment but a different suggestion! I think this is a good idea as well/instead. I still think it might be worth making it configurable though - what do you think? |
|
Just reading through the comments @tsmbland @alexdewar this is my todo;
was there anything else |
I'm not averse to making it configurable. I guess for consistency with the other options though, we should make it configurable in That's a little faffier to implement (sorry, @mjademitchell!) -- but if you want an example, you can look at the ...and on that note, I'm wondering if it might be nicer if we could come up with a way that users can override arbitrary options for
Sounds good! |
Yes I would say so! @mjademitchell Happy if you'd rather open this as an issue to tackle in another PR. Not necessarily essential for this PR |
@alexdewar I think that could work, so long as we don't end up making Edit: Also that some options in |
Agree with this ☝️. Dw about fixing it now if it turns out to be a faff @mjademitchell!
I've opened an issue for it (#1284). We might be able to bundle some options (e.g. the |
…t to the gitignore
I am getting a bug with my pre commit for some reason its not working but maybe its my python verison |
What's the error message you see? |
[INFO] Restored changes from /home/mmitchel/.cache/pre-commit/patch1778745740-151170. |
|
@mjademitchell Oh, that is weird. Looks like you're using Python 3.13, which is pretty up to date, so that should be fine. Could you try installing |
|
Oh, wait. I misread that. I don't know that you are using Python 3.13, actually. But anyway, might be worth trying with Failing that, there is also |
It worked! |
…t to the gitignore
840f795 to
31ed4a1
Compare
Thats done! hopefully i wrote a good enough description |
a80976a to
ac1b168
Compare


Description
I created a
copy_input_filesfunction that allow when simulation has ran it copies input files into aninput/subdirectory of the output folder.I also included the copied files to set to read-only
Fixes #1109
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks