Skip to content

Commit

Permalink
fix small issues with docker
Browse files Browse the repository at this point in the history
  • Loading branch information
djeck1432 committed Nov 1, 2024
1 parent 196144a commit 9d75cb5
Show file tree
Hide file tree
Showing 6 changed files with 4,239 additions and 42 deletions.
1 change: 1 addition & 0 deletions apps/data_handler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ RUN pip install poetry \
# Adjust build context for folders out of Docker context
# Assuming data_handler and shared are located in the root directory, set the context to root
COPY shared /code/shared
COPY data_handler /code/data_handler

ENTRYPOINT ["bash", "/code/entrypoint.sh"]
6 changes: 3 additions & 3 deletions apps/data_handler/celery_app/celery_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
# run_liquidable_debt_computation_for_hashstack_v0,;
# run_liquidable_debt_computation_for_hashstack_v1,; uniswap_v2_order_book,

from data_handler.celery_app.tasks import (
run_liquidable_debt_computation_for_zklend, )
from data_handler.celery_app.order_books_tasks import ekubo_order_book
# from data_handler.celery_app.tasks import (
# run_liquidable_debt_computation_for_zklend, )
# from data_handler.celery_app.order_books_tasks import ekubo_order_book
import os

from celery import Celery
Expand Down
2 changes: 1 addition & 1 deletion apps/data_handler/celery_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from data_handler.db.crud import DBConnector
from data_handler.db.models import OrderBookModel

from .celery_conf import app
from data_handler.celery_app.celery_conf import app

connector = DBConnector()

Expand Down
24 changes: 12 additions & 12 deletions apps/data_handler/db/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
)

from data_handler.db.models.zklend_events import (
AccumulatorsSyncEventData,
LiquidationEventData,
AccumulatorsSyncEventModel,
LiquidationEventModel,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -559,8 +559,8 @@ class ZkLendEventDBConnector(DBConnector):
Provides CRUD operations specifically for ZkLend events, such as accumulator sync
and liquidation events.
Methods:
- create_accumulator_event: Creates an AccumulatorsSyncEventData record.
- create_liquidation_event: Creates a LiquidationEventData record.
- create_accumulator_event: Creates an AccumulatorsSyncEventModel record.
- create_liquidation_event: Creates a LiquidationEventModel record.
- get_all_events: Retrieves events based on filtering criteria such as protocol_id,
event_name, or block_number.
"""
Expand All @@ -569,7 +569,7 @@ def create_accumulator_event(
self, protocol_id: str, event_name: str, block_number: int, event_data: dict
) -> None:
"""
Creates an AccumulatorsSyncEventData record in the database.
Creates an AccumulatorsSyncEventModel record in the database.
:param protocol_id: The protocol ID for the event.
:param event_name: The name of the event.
:param block_number: The block number associated with the event.
Expand All @@ -578,7 +578,7 @@ def create_accumulator_event(
"""
db = self.Session()
try:
event = AccumulatorsSyncEventData(
event = AccumulatorsSyncEventModel(
protocol_id=protocol_id,
event_name=event_name,
block_number=block_number,
Expand All @@ -590,7 +590,7 @@ def create_accumulator_event(
db.commit()
except SQLAlchemyError as e:
db.rollback()
logger.error(f"Error creating AccumulatorsSyncEventData: {e}")
logger.error(f"Error creating AccumulatorsSyncEventModel: {e}")
raise e
finally:
db.close()
Expand All @@ -599,7 +599,7 @@ def create_liquidation_event(
self, protocol_id: str, event_name: str, block_number: int, event_data: dict
) -> None:
"""
Creates a LiquidationEventData record in the database.
Creates a LiquidationEventModel record in the database.
:param protocol_id: The protocol ID for the event.
:param event_name: The name of the event.
:param block_number: The block number associated with the event.
Expand All @@ -609,7 +609,7 @@ def create_liquidation_event(
"""
db = self.Session()
try:
event = LiquidationEventData(
event = LiquidationEventModel(
protocol_id=protocol_id,
event_name=event_name,
block_number=block_number,
Expand All @@ -625,7 +625,7 @@ def create_liquidation_event(
db.commit()
except SQLAlchemyError as e:
db.rollback()
logger.error(f"Error creating LiquidationEventData: {e}")
logger.error(f"Error creating LiquidationEventModel: {e}")
raise e
finally:
db.close()
Expand Down Expand Up @@ -661,8 +661,8 @@ def apply_filters(query):
query = query.filter_by(block_number=block_number)
return query

accumulator_query = apply_filters(db.query(AccumulatorsSyncEventData))
liquidation_query = apply_filters(db.query(LiquidationEventData))
accumulator_query = apply_filters(db.query(AccumulatorsSyncEventModel))
liquidation_query = apply_filters(db.query(LiquidationEventModel))
combined_query = accumulator_query.union(liquidation_query)
events = combined_query.all()
return events
Expand Down
Loading

0 comments on commit 9d75cb5

Please sign in to comment.