Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

also allow hardcoded providers #155

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading