Skip to content

Commit

Permalink
Problem: output artifact gets expired easily (#1671)
Browse files Browse the repository at this point in the history
* Problem: output artifact gets expired easily

record in log

* cleanup

* fix

---------

Co-authored-by: HuangYi <huang@crypto.com>
  • Loading branch information
mmsqe and yihuang authored Nov 4, 2024
1 parent 9a9018f commit 45aaff0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions testground/benchmark/benchmark/stateless.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from .stats import dump_block_stats
from .topology import connect_all
from .types import PeerPacket
from .utils import block_height, block_txs, wait_for_block, wait_for_port
from .utils import Tee, block_height, block_txs, wait_for_block, wait_for_port

# use cronosd on host machine
LOCAL_CRONOSD_PATH = "cronosd"
Expand Down Expand Up @@ -303,7 +303,7 @@ def do_run(
detect_idle_halted(cfg["num_idle"], 5)

with (home / "block_stats.log").open("w") as logfile:
dump_block_stats(logfile)
dump_block_stats(Tee(logfile, sys.stdout))

proc.kill()
proc.wait(20)
Expand Down
12 changes: 12 additions & 0 deletions testground/benchmark/benchmark/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,15 @@ def split_batch(a: int, size: int):
if m:
parts.append((k * size, a))
return parts


class Tee:
def __init__(self, f1, f2):
self.f1 = f1
self.f2 = f2

def write(self, s) -> int:
s1 = self.f1.write(s)
s2 = self.f2.write(s)
assert s1 == s2
return s1

0 comments on commit 45aaff0

Please sign in to comment.