Skip to content

Commit

Permalink
Problem: testground output artifact too large (#1546)
Browse files Browse the repository at this point in the history
Solution:
- cleanup some duplicated stuff
  • Loading branch information
yihuang authored Aug 12, 2024
1 parent d17e654 commit b4cb3ed
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion testground/benchmark/benchmark/stateless.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def run(
# collect outputs
output = Path("/data.tar.bz2")
with tarfile.open(output, "x:bz2") as tar:
tar.add(home, arcname="data")
tar.add(home, arcname="data", filter=output_filter(group, group_seq))
outdir = Path(outdir)
if outdir.exists():
assert outdir.is_dir()
Expand All @@ -176,6 +176,31 @@ def run(
shutil.copy(output, filename)


def output_filter(group, group_seq: int):
"""
filter out some big and useless paths to reduce size of output artifacts
"""

is_validator_leader = group == VALIDATOR_GROUP and group_seq == 0
is_fullnode_leader = group == FULLNODE_GROUP and group_seq == 0

def inner(info: tarfile.TarInfo):
# only keep one copy
if not is_validator_leader and info.name in (
"data/data/cs.wal",
"data/data/blockstore.db",
"data/data/application.db",
"data/data/memiavl.db",
"data/data/state.db",
):
return None
if not is_fullnode_leader and info.name == "data/data/tx_index.db":
return None
return info

return inner


def detect_idle(idle_blocks: int, interval: int):
"""
returns if the chain is empty for consecutive idle_blocks
Expand Down

0 comments on commit b4cb3ed

Please sign in to comment.