Skip to content

Commit

Permalink
Update status reports
Browse files Browse the repository at this point in the history
- include time limit information in console output
- always include instance count
  • Loading branch information
tysmith committed Sep 12, 2023
1 parent a223e6d commit 6db5300
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 13 additions & 8 deletions grizzly/common/status_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def summary(
"""Merge and generate a summary from status reports.
Args:
rate (bool): Include iteration rate.
runtime (bool): Include total runtime in output.
sysinfo (bool): Include system info (CPU, disk, RAM... etc) in output.
timestamp (bool): Include time stamp in output.
Expand All @@ -236,7 +237,6 @@ def summary(
# calculate totals
iterations = tuple(x.iteration for x in self.reports)
log_sizes = tuple(x.log_size for x in self.reports)
rates = tuple(x.rate for x in self.reports)
results = tuple(x.results.total for x in self.reports)
count = len(self.reports)
total_ignored = sum(x.ignored for x in self.reports)
Expand All @@ -250,10 +250,13 @@ def summary(

# Rate
if rate:
rates = tuple(x.rate for x in self.reports)
disp = [f"{count} @ {sum(rates):0.2f}"]
if count > 1:
disp.append(f" ({max(rates):0.2f}, {min(rates):0.2f})")
entries.append(("Rate", "".join(disp)))
else:
entries.append(("Instances", str(count)))

# Results
if total_iters:
Expand Down Expand Up @@ -893,7 +896,7 @@ def main(args=None):
"--time-limit",
type=int,
help="Maximum age of reports in seconds. Use zero for no limit."
f" (default: {', '.join(f'{k}: {v}s' for k, v in report_types.items())})",
f" (default: {', '.join(f'{k}: {v}' for k, v in report_types.items())})",
)
parser.add_argument(
"--tracebacks",
Expand Down Expand Up @@ -928,14 +931,16 @@ def main(args=None):
return 0

if not reporter.reports:
LOG.info("Grizzly Status - No status reports to display")
LOG.info(
"Grizzly Status - No status reports to display (time-limit: %s)",
_format_seconds(time_limit),
)
return 0

LOG.info(
"Grizzly Status - %s - Instance report frequency: %ds\n",
strftime("%Y/%m/%d %X"),
REPORT_RATE,
)
LOG.info("Grizzly Status - %s", strftime("%Y/%m/%d %X"))
LOG.info("Instance report frequency: %s", _format_seconds(REPORT_RATE))
LOG.info("Time limit filter: %s", _format_seconds(time_limit))
LOG.info("")
LOG.info("[Reports]")
LOG.info(reporter.specific())
if reporter.has_results:
Expand Down
4 changes: 3 additions & 1 deletion grizzly/common/test_status_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def test_status_reporter_04(mocker, tmp_path):
assert len(rptr.reports) == 1
output = rptr.summary(runtime=False)
assert "Iteration" in output
assert "Instances" not in output
assert "Rate" in output
assert "Results" in output
assert "Blockers" not in output
Expand All @@ -313,14 +314,15 @@ def test_status_reporter_04(mocker, tmp_path):
assert len(rptr.reports) == 2
output = rptr.summary(rate=False, sysinfo=True, timestamp=True)
assert "Iteration" in output
assert "Instances" in output
assert "Rate" not in output
assert "Results" in output
assert "Ignored" in output
assert "Logs" in output
assert "Runtime" in output
assert "Timestamp" in output
lines = output.split("\n")
assert len(lines) == 9
assert len(lines) == 10
# verify alignment
position = len(lines[0].split(":")[0])
for line in lines:
Expand Down

0 comments on commit 6db5300

Please sign in to comment.