Conversation
SarahAlidoost
left a comment
There was a problem hiding this comment.
@SCiarella nice implementation, thanks! 👍 I left some comments. The main point is to not call the setup in init method, see my comment. If something isn't clear, we can discuss it offline.
Also, sonar complains that there are not enough tests for Engine. Perhaps, after implementing the changes, this will be solved. Otherwise, can you please add more tests?
One more thing, the build action was failed due to FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/diffWOFOST/diffWOFOST/tests/physical_models/test_data/test_phenology_wofost72_24.yaml'. But this test passes locally. I re-ran the action but still the same. Can you please check?
Co-authored-by: SarahAlidoost <55081872+SarahAlidoost@users.noreply.github.com>
Co-authored-by: SarahAlidoost <55081872+SarahAlidoost@users.noreply.github.com>
Co-authored-by: SarahAlidoost <55081872+SarahAlidoost@users.noreply.github.com>
Co-authored-by: SarahAlidoost <55081872+SarahAlidoost@users.noreply.github.com>
|
@SarahAlidoost Thanks for the feedback! Unfortunately sonarcloud is still not satisfied. I was thinking that maybe sonarcloud has problems in calculating the coverage when using the multiprocess version of |
|
SarahAlidoost
left a comment
There was a problem hiding this comment.
@SCiarella thanks for addressing the comments, looks great! 👍


Closes #21 (and #20).
This PR separates engine construction from runtime setup so the same Engine instance can be reused across multiple parameter sets without re-instantiating the full model stack each time.
The main goal is to support workflows where parameters are updated repeatedly, especially in differentiable and optimization use cases, while avoiding the current need to deep-copy the parameter provider before every run.
Changes
setup(...toEnginesetupwhenEngineis initialize_reset_runtime_statemethod so an engine instance can be safely reused_finish_cropsimulationto avoid callingclear_override()that would pop away variables from theEngineVariableKioskto support external states the main engineEngineTestHelperso it relies on the same engine setup logicEngineTestHelperonce and call setup(...) for each forward pass, so that we can avoid the combo ofpop+deepcopySo now we basically go from this (before):
to this (after):