From a44126766b243bf7e59a30b9d626e22d277a5ee5 Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Fri, 25 Oct 2024 10:27:03 +0200 Subject: [PATCH 1/3] remove assert for solver overlap the assert is not required in the remainder of the code, as individual rows are just uploaded to dune as is --- src/fetch/orderbook.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/fetch/orderbook.py b/src/fetch/orderbook.py index 82eb4e1b..ffdc61fd 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,7 +99,12 @@ 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 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" + ) + if not prod.empty and not barn.empty: return pd.concat([prod, barn]) if not prod.empty: @@ -143,7 +151,14 @@ 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 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]) + if not prod.empty and not barn.empty: return pd.concat([prod, barn]) if not prod.empty: From a026c236ec2ec92b173e862efede8afe0c2a3fcc Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Fri, 25 Oct 2024 10:44:26 +0200 Subject: [PATCH 2/3] remove unintended return statement --- src/fetch/orderbook.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/fetch/orderbook.py b/src/fetch/orderbook.py index ffdc61fd..0c98bb9e 100644 --- a/src/fetch/orderbook.py +++ b/src/fetch/orderbook.py @@ -157,8 +157,6 @@ def get_batch_rewards(cls, block_range: BlockRange) -> DataFrame: f"{set(prod.solver).intersection(set(barn.solver))} part of both prod and barn" ) - return pd.concat([prod, barn]) - if not prod.empty and not barn.empty: return pd.concat([prod, barn]) if not prod.empty: From 200a0919f58d09850cde286613c8bcac816816a3 Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Fri, 25 Oct 2024 16:30:01 +0200 Subject: [PATCH 3/3] remove special handling of empty dataframes --- src/fetch/orderbook.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/fetch/orderbook.py b/src/fetch/orderbook.py index 0c98bb9e..974e97cd 100644 --- a/src/fetch/orderbook.py +++ b/src/fetch/orderbook.py @@ -105,13 +105,7 @@ def get_order_rewards(cls, block_range: BlockRange) -> DataFrame: f"{set(prod.solver).intersection(set(barn.solver))} part of both prod and barn" ) - 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() + return pd.concat([prod, barn]) @classmethod def get_batch_rewards(cls, block_range: BlockRange) -> DataFrame: @@ -157,13 +151,7 @@ def get_batch_rewards(cls, block_range: BlockRange) -> DataFrame: f"{set(prod.solver).intersection(set(barn.solver))} part of both prod and barn" ) - 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() + return pd.concat([prod, barn]) @classmethod def get_app_hashes(cls) -> DataFrame: