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

Status report updates #372

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions grizzly/common/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
REPORT_RATE = 60
# default life time for report entries in the database (24 hours)
REPORTS_EXPIRE = 86400
# default life time for result entries in the database (30 days)
RESULTS_EXPIRE = 2592000
# default life time for result entries in the database (14 days)
RESULTS_EXPIRE = 1209600
# status database files
STATUS_DB_FUZZ = grz_tmp() / "fuzz-status.db"
STATUS_DB_REDUCE = grz_tmp() / "reduce-status.db"
Expand Down
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
Loading