Skip to content

Commit

Permalink
common: track progress when writing debug data
Browse files Browse the repository at this point in the history
Debug data may be very large so add progress bars to hint that CC is not
frozen, just busy writing.
  • Loading branch information
JulioLoayzaM committed Jun 12, 2024
1 parent f1f3e42 commit d206b34
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crypto_condor/primitives/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import attrs
from rich.console import Console as RichConsole
from rich.panel import Panel
from rich.progress import track
from rich.prompt import Confirm, Prompt

# --------------------------- Module --------------------------------------------------
Expand Down Expand Up @@ -804,13 +805,18 @@ def process_results(
if debug_data:
printer.print()
if isinstance(res, ResultsDict):
count = 0
num_res = len(res)
for name, r in res.items():
count += 1
header = f"Debug data: {name}"
line = "^" * len(header)
printer.print(header)
printer.print(line)
printer.print()
for data in r.data.values():
for data in track(
r.data.values(), f"Writing debug data {count}/{num_res}"
):
printer.print(str(data))
# For TestInfo we have to print the debug data
# separately.
Expand All @@ -822,7 +828,7 @@ def process_results(
printer.print(header)
printer.print(line)
printer.print()
for data in res.data.values():
for data in track(res.data.values(), "Writing debug data"):
printer.print("data", str(data))
# For TestInfo we have to print the debug data separately.
if isinstance(data, TestInfo):
Expand Down

0 comments on commit d206b34

Please sign in to comment.