From de55c578db81925978133b007a4e467dba214d59 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Mon, 9 Sep 2024 14:49:05 +0100 Subject: [PATCH] Set macro cache to off by default Fixes #271 --- changelog_entry.yaml | 4 ++++ policyengine_core/simulations/simulation.py | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..5f4ae91f 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + changed: + - Disable macro cache by default. diff --git a/policyengine_core/simulations/simulation.py b/policyengine_core/simulations/simulation.py index d3d90b84..d43d5d39 100644 --- a/policyengine_core/simulations/simulation.py +++ b/policyengine_core/simulations/simulation.py @@ -69,10 +69,10 @@ class Simulation: is_over_dataset: bool = False """Whether this simulation is built over a dataset.""" - macro_cache_read: bool = True + macro_cache_read: bool = False """Whether to read from the macro cache.""" - macro_cache_write: bool = True + macro_cache_write: bool = False """Whether to write to the macro cache.""" start_instant: str = None @@ -1419,6 +1419,8 @@ def check_macro_cache(self, variable_name: str, period: str) -> bool: """ Check if the variable is able to have cached value """ + if not self.macro_cache_read: + return False # Dataset should always exist, but just in case if not hasattr(self, "dataset"):