Skip to content

Commit

Permalink
fix generate_data args
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejka committed Oct 17, 2024
1 parent d8b8354 commit 4fa069a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions scripts/data/client2.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@


# Function to calculate weight of a block
def calculate_job_weight(block_data):
def calculate_batch_weight(block_data):
return sum(
len(tx["inputs"]) + len(tx["outputs"])
for block in block_data["blocks"]
for tx in block["transactions"]
)


# Generator function to create jobs
def job_generator(start, blocks, step, mode, strategy):
BASE_DIR.mkdir(exist_ok=True)
Expand All @@ -46,19 +45,17 @@ def job_generator(start, blocks, step, mode, strategy):
for height in height_range:
batch_file = BASE_DIR / f"{mode}_{height}_{step}.json"

generate_data(
fast=True,
batch_data = generate_data(
mode=mode,
height=height,
initial_height=height,
num_blocks=step,
fast=True,
output_file=str(batch_file),
)

# Placeholder: Assuming generated data can be loaded from the batch_file
with open(batch_file, "r") as f:
block_data = json.load(f)
Path(batch_file).write_text(json.dumps(batch_data, indent=2))

batch_weight = calculate_job_weight(block_data)
batch_weight = calculate_batch_weight(batch_data)
yield batch_file, batch_weight


Expand Down

0 comments on commit 4fa069a

Please sign in to comment.