diff --git a/src/fetch/orderbook.py b/src/fetch/orderbook.py index 82eb4e1b..974e97cd 100644 --- a/src/fetch/orderbook.py +++ b/src/fetch/orderbook.py @@ -12,9 +12,12 @@ from sqlalchemy import create_engine from sqlalchemy.engine import Engine +from src.logger import set_log from src.models.block_range import BlockRange from src.utils import open_query +log = set_log(__name__) + MAX_PROCESSING_DELAY = 10 @@ -96,14 +99,13 @@ def get_order_rewards(cls, block_range: BlockRange) -> DataFrame: ) # Solvers do not appear in both environments! - assert set(prod.solver).isdisjoint(set(barn.solver)), "solver overlap!" - if not prod.empty and not barn.empty: - return pd.concat([prod, barn]) - if not prod.empty: - return prod.copy() - if not barn.empty: - return barn.copy() - return pd.DataFrame() + if set(prod.solver).isdisjoint(set(barn.solver)): + log.warning( + f"solver overlap in {block_range}: solvers " + f"{set(prod.solver).intersection(set(barn.solver))} part of both prod and barn" + ) + + return pd.concat([prod, barn]) @classmethod def get_batch_rewards(cls, block_range: BlockRange) -> DataFrame: @@ -143,14 +145,13 @@ def get_batch_rewards(cls, block_range: BlockRange) -> DataFrame: ) # Solvers do not appear in both environments! - assert set(prod.solver).isdisjoint(set(barn.solver)), "solver overlap!" - if not prod.empty and not barn.empty: - return pd.concat([prod, barn]) - if not prod.empty: - return prod.copy() - if not barn.empty: - return barn.copy() - return pd.DataFrame() + if set(prod.solver).isdisjoint(set(barn.solver)): + log.warning( + f"solver overlap in {block_range}: solvers " + f"{set(prod.solver).intersection(set(barn.solver))} part of both prod and barn" + ) + + return pd.concat([prod, barn]) @classmethod def get_app_hashes(cls) -> DataFrame: