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

Problem: testground no log on failure #1581

Merged
merged 1 commit into from
Sep 16, 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
32 changes: 18 additions & 14 deletions testground/benchmark/benchmark/stateless.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ def patchimage(toimage, src, dst, fromimage):
@click.option("--cronosd", default=CONTAINER_CRONOSD_PATH)
@click.option("--global-seq", default=None)
def run(outdir: str, datadir: str, cronosd, global_seq):
run_echo_server(ECHO_SERVER_PORT)

datadir = Path(datadir)
cfg = json.loads((datadir / "config.json").read_text())

Expand All @@ -182,9 +180,26 @@ def run(outdir: str, datadir: str, cronosd, global_seq):
group = VALIDATOR_GROUP if global_seq < validators else FULLNODE_GROUP
group_seq = global_seq if group == VALIDATOR_GROUP else global_seq - validators
print("node role", global_seq, group, group_seq)

home = datadir / group / str(group_seq)

try:
return do_run(home, cronosd, group, cfg)
finally:
# collect outputs
output = Path("/data.tar.bz2")
with tarfile.open(output, "x:bz2") as tar:
tar.add(home, arcname="data", filter=output_filter(group, group_seq))
outdir = Path(outdir)
if outdir.exists():
assert outdir.is_dir()
filename = outdir / f"{group}_{group_seq}.tar.bz2"
filename.unlink(missing_ok=True)
shutil.copy(output, filename)


def do_run(home: str, cronosd: str, group: str, cfg: dict):
run_echo_server(ECHO_SERVER_PORT)

# wait for persistent peers to be ready
wait_for_peers(home)

Expand Down Expand Up @@ -215,17 +230,6 @@ def run(outdir: str, datadir: str, cronosd, global_seq):
proc.kill()
proc.wait(20)

# collect outputs
output = Path("/data.tar.bz2")
with tarfile.open(output, "x:bz2") as tar:
tar.add(home, arcname="data", filter=output_filter(group, group_seq))
outdir = Path(outdir)
if outdir.exists():
assert outdir.is_dir()
filename = outdir / f"{group}_{group_seq}.tar.bz2"
filename.unlink(missing_ok=True)
shutil.copy(output, filename)


def output_filter(group, group_seq: int):
"""
Expand Down
Loading