avoid animal and manure modules if no animals simulated#2732
avoid animal and manure modules if no animals simulated#2732PooyaHekmati merged 24 commits intodevfrom
Conversation
|
Current Coverage: % Mypy errors on no_animal_daily_simulation_fix branch: 1677 |
|
🚨 Please update the changelog. This PR cannot be merged until |
…uminantFarmSystems/RuFaS into no_animal_daily_simulation_fix
|
Current Coverage: 99% Mypy errors on no_animal_daily_simulation_fix branch: 1677 |
|
@JoeWaddell We had a brief discussion about this in the dev-team and think this should either have further discussion as to whether a no-animals simulation should (and should be assumed) to not run the feed/manure modules. Alternatively, if that's the definite intention of this task, we thought the task should be renamed to something like |
After quickly consulting with Kristan, what I'll do is move the new if statement back down to only route around the manure parts specifically: the little block where it collects manure from HerdManager and shunts it to the ManureManager. That way we can still call it a no_animals run, as it will still run the Crop and Soil and Feed modules, and much of the Animal module. |
|
Current Coverage: 99% Mypy errors on no_animal_daily_simulation_fix branch: 1677 |
ew3361zh
left a comment
There was a problem hiding this comment.
LGTM, I have a couple small suggestions which should be easy enough to implement if you agree.
RUFAS/simulation_engine.py
Outdated
| all_manure_data = self.herd_manager.daily_routines( | ||
| self.feed_manager.available_feeds, self.time, self.weather, total_inventory | ||
| ) | ||
| if self.im.get_data("config.simulate_animals"): |
There was a problem hiding this comment.
rather than calling on IM every day, I think it would be better to set this as an attribute in the SimulationEngine after self.im = InputManager().
e.g.
class SimulationEngine:
...
self.im = InputManager()
self.simulate_animals = self.im.get_data("config.simulate_animals")
...and then update this line:
if self.im.get_data("config.simulate_animals"):
to
if self.simulate_animals:
It would probably also be worth then using this self.simulate_animals later on in the generate_daily_manure_applications() call which also gets this data from IM.
This is assuming we wouldn't want the ability to change this midway through a simulation.
| self.feed_manager.available_feeds, self.time, self.weather, total_inventory | ||
| ) | ||
|
|
||
| self.manure_manager.run_daily_update( |
There was a problem hiding this comment.
I still think we should revisit the name of this task if we're not running manure daily routines but will leave that to the SME team.
allisterakun
left a comment
There was a problem hiding this comment.
I do agree with both of Niko's comments. Otherwise LGTM
|
Great comments, updated the code accordingly! I'll let @KFosterReed and/or @elle-andreen chime in re: the name change. I don't have a problem either way, but I think "no animal" still makes sense since the Manure module, as it works right now, logically shouldn't function without animals being simulated (but the other modules can). |
|
Thanks team! I agree with Joe that leaving the task as |
|
Current Coverage: 99% Mypy errors on no_animal_daily_simulation_fix branch: 1677 |
@JoeWaddell @KFosterReed I agree that 'no_animal' still makes sense in this context! |
Context
After changes in #2721, no_animal_task returns the new error!
What
This PR skips the Feed, Animal, and Manure modules if no animals are simulated.
Why
Those modules shouldn't need to be run if no animals are present - barring future changes where manure processing of user configured manure (e.g. external sources) should be handled appropriately.
One big consideration
Should Feed Storage be "happening" even without animals? My understanding is that it would only be impacting/recorded when fed out, but this might be an oversight. If so: we just need to move the check in simulation_engine.py a little lower down in the method.
Test plan
Updated existing unit test to always assume animals are simulated, but we should likely add a new unit test to ensure methods are or aren't being called when animals aren't simulated.
Input Changes
Output Changes
Filter