Fixing ve_run command line configuration #1242
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1242 +/- ##
===========================================
+ Coverage 94.95% 95.05% +0.09%
===========================================
Files 71 71
Lines 7291 7293 +2
===========================================
+ Hits 6923 6932 +9
+ Misses 368 361 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
alexdewar
left a comment
There was a problem hiding this comment.
Makes sense to me, although I've got a couple of questions:
- Is there a test that checks that this override functionality works? If not, would it be worth adding one?
- Have you got any idea how long this has been broken for?
The snakemake template has sadly been broken for a while now 😞 and I haven't got round to fixing it... I can though, if that would be useful to you. I had a PR with mysterious CI failures on Windows that I could debug easily (ImperialCollegeLondon/virtual_ecosystem_snakemake_template#51) and then I got distracted with other things. I suppose it might be worth checking whether it works with the version of VR in this current PR though!
There isn't a test -
I think... always? The dictionary merging function (was dest = deepcopy(dest)
source = deepcopy(source)And I think that is where it goes off the rails and breaks the mutation of the original passed in dictionary. We just never tested it and the snakemake template was at a stage where we wouldn't spot if a config change made any differences? |
Ah ok. Yes, that's what I was curious about! |
|
@alexdewar I've added a really simple test that just checks that the CLI input makes it through to the |
Description
The
ve_runcommand is supposed to take configuration overrides asve_run ... --param plants.constants.value=0.6but those values are currently silently swallowed: the dictionary passed into_parse_command_line_paramswas intended to be updated but was redefined within the function and so the updates never propagated back out into the configuration.This PR:
paramstoconfigto make it more obvious that this is modifying the model configuration.It also updates
test_ve_runto only run 2 months of simulation. We simply don't need a 24 month simulation as part of the unit testing: two updates is enough to verify that the basic model flow is working and drastically reduces the run time of that test (on my laptop: 180 seconds down to 25 seconds). This was the motivating case for the command line override that revealed the bug.The Actions testing runtime for the OS/Python combos drops by about 2/3rds: worst case is Windows down from 10' to 3'30". The docs build is now the bad citizen in the actions runtime.
@alexdewar This likely breaks ImperialCollegeLondon/virtual_ecosystem_snakemake_template?
Fixes #1241
Type of change
Key checklist
pre-commitchecks:$ pre-commit run -a$ poetry run pytestFurther checks