Skip to content

Commit

Permalink
Add some logging. Remove unused list function
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevs committed Feb 11, 2022
1 parent d9439df commit b1d4cb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
4 changes: 1 addition & 3 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from mev_inspect.prices import fetch_prices, fetch_prices_range
from mev_inspect.queue.broker import connect_broker
from mev_inspect.queue.tasks import inspect_many_blocks_task
from mev_inspect.s3_export import export_block_range, list_export_bucket
from mev_inspect.s3_export import export_block_range

RPC_URL_ENV = "RPC_URL"

Expand Down Expand Up @@ -126,8 +126,6 @@ def fetch_all_prices():
@click.argument("before_block_number", type=int)
def s3_export(after_block_number: int, before_block_number: int):
inspect_db_session = get_inspect_session()

print(list_export_bucket())
export_block_range(inspect_db_session, after_block_number, before_block_number)


Expand Down
13 changes: 5 additions & 8 deletions mev_inspect/s3_export.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import logging

import boto3

Expand All @@ -12,6 +13,8 @@
block_number < :before_block_number
"""

logger = logging.getLogger(__name__)


def export_block_range(
inspect_db_session, after_block_number: int, before_block_number
Expand Down Expand Up @@ -39,21 +42,15 @@ def export_block_range(
Key=key,
)


def list_export_bucket():
client = get_s3_client()
return client.list_objects_v2(
Bucket=get_export_bucket_name(),
Prefix="/",
)
logger.info(f"Exported to {key}")


# TODO - replaced by ConfigMap
def get_export_bucket_name() -> str:
return "local-export"


# TODO
# TODO - handle for production
def get_s3_client():
return boto3.client(
"s3",
Expand Down

0 comments on commit b1d4cb8

Please sign in to comment.