diff --git a/batch/batch/driver/billing_manager.py b/batch/batch/driver/billing_manager.py index bfe57930cdc..3423f228dd7 100644 --- a/batch/batch/driver/billing_manager.py +++ b/batch/batch/driver/billing_manager.py @@ -67,7 +67,7 @@ async def _refresh_resources_from_retail_prices(self, prices: List[Price]): if current_resource_rate is None: resource_updates.append((resource_name, latest_resource_rate)) - elif abs(current_resource_rate - latest_resource_rate) > 1e-20: + elif current_product_version == latest_product_version and current_resource_rate != latest_resource_rate: log.error( f'resource {resource_name} does not have the latest rate in the database for ' f'version {current_product_version}: {current_resource_rate} vs {latest_resource_rate}; ' @@ -75,6 +75,14 @@ async def _refresh_resources_from_retail_prices(self, prices: List[Price]): ) continue + if current_product_version and current_product_version != latest_product_version: + # this prevents having too many resources in the database with redundant information + if current_resource_rate == latest_resource_rate: + log.info( + f'ignoring price update for product {product} -- the latest rate is equal to the previous rate' + ) + continue + if price.is_current_price() and ( current_product_version is None or current_product_version != latest_product_version ):