Skip to content

Commit

Permalink
also allow hardcoded providers (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
anjor authored Sep 9, 2024
1 parent 16ff1e9 commit c5f36b0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dataprep-tools/filecoin/boost_create_deals.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
VERSION = "0.0.1"

start_epoch_head_offset = int(604800 / 30)
default_replication_factor = 3

# This script creates deals for an epoch stored in s3.
#
Expand All @@ -42,6 +43,7 @@
# DEALS_FOLDER: the folder to store the deals csv output file in
# FILECOIN_RPC_ENDPOINT: the filecoin rpc endpoint
# CID_GRAVITY_KEY: api key for cid gravity
# USE_CID_GRAVITY: if set to true, the script will use cid gravity to find providers
#
# It expects the following arguments:
# epoch: the epoch to create deals for
Expand Down Expand Up @@ -133,6 +135,12 @@ def get_providers(
padded_size,
):

if not environ.get("USE_CID_GRAVITY"):
providers = environ.get("PROVIDERS")
assert providers, "PROVIDERS environment variable must be set if not using CID gravity"
providers = providers.split(",")
return provideres

head = get_chain_head()
start_epoch = head + start_epoch_head_offset

Expand Down Expand Up @@ -233,7 +241,7 @@ def create_deals(metadata_obj):

deal_data.append(deal_data_item)

replication_factor = int(environ.get("REPLICATION_FACTOR"))
replication_factor = int(environ.get("REPLICATION_FACTOR", default_replication_factor))
deals_providers = {}

fields = [
Expand Down

0 comments on commit c5f36b0

Please sign in to comment.