From be3a7dfda37a59dbc74c0aa0c17b6c87c8951e63 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Thu, 19 Dec 2024 16:29:59 +0200 Subject: [PATCH] feat: overwrite the configurable params after reading policy --- .../decision_maker_abci/behaviours/storage_manager.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index be7e58f5..df5b4bf4 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -234,8 +234,13 @@ def _try_recover_policy(self) -> Optional[EGreedyPolicy]: try: policy_path = self.params.store_path / POLICY_STORE with open(policy_path, "r") as f: - policy = f.read() - return EGreedyPolicy.deserialize(policy) + policy_raw = f.read() + policy = EGreedyPolicy.deserialize(policy_raw) + # overwrite the configurable parameters + policy.eps = self.params.epsilon + policy.consecutive_failures_threshold = self.params.policy_threshold + policy.quarantine_duration = self.params.tool_quarantine_duration + return policy except Exception as e: self.context.logger.warning(f"Could not recover the policy: {e}.") return None