From 31462e106ec4cba52b9df2b8c3a9e0f90aaa59a9 Mon Sep 17 00:00:00 2001 From: Nickolas Comeau Date: Tue, 29 Aug 2023 16:14:03 -0400 Subject: [PATCH] Make sure investment is only being referenced if it exists (#321) Co-authored-by: Nickolas Comeau --- bank/account_logic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bank/account_logic.py b/bank/account_logic.py index 70193033..84b257fe 100644 --- a/bank/account_logic.py +++ b/bank/account_logic.py @@ -895,7 +895,7 @@ def update_status(self) -> None: if not proposal: # Try to cover current raw usage with investment service units total_usage = slurm_acct.get_cluster_usage_total(in_hours=True) - if total_usage <= investment_sus: + if investment and (total_usage <= investment_sus): LOG.debug(f"Using investment service units to cover usage with no active proposal " f"for {self._account_name}") investment.current_sus -= total_usage