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

Account for "dateless" datasets #3623

Merged
merged 1 commit into from
Jun 13, 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
11 changes: 7 additions & 4 deletions lib/pbench/cli/server/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ def summarize_dates(base_query: Query, options: dict[str, Any]):
this_month = 0
this_week = 0
this_day = 0
in_range = 0
count = 0
dateless = 0

filters = []

Expand All @@ -437,14 +438,14 @@ def summarize_dates(base_query: Query, options: dict[str, Any]):
rows = query.execution_options(stream_results=True).yield_per(SQL_CHUNK)

for row in rows:
count += 1
date: datetime.datetime = row[0]
if not isinstance(date, datetime.datetime):
detailer.message(f"Got non-datetime row {row}")
dateless += 1
continue
if not first:
first = date
last = date
in_range += 1
by_year[date.year] += 1
by_month[date.month] += 1
by_day[date.day] += 1
Expand All @@ -466,7 +467,9 @@ def summarize_dates(base_query: Query, options: dict[str, Any]):
)
return

click.echo(f" {in_range:,d} from {first:%Y-%m-%d %H:%M} to {last:%Y-%m-%d %H:%M}")
click.echo(f" {count:,d} from {first:%Y-%m-%d %H:%M} to {last:%Y-%m-%d %H:%M}")
if dateless:
click.echo(f" (count includes {dateless:,d} datasets without a date)")

if start < year:
click.echo(f" {this_year:,d} in year {year:%Y}")
Expand Down
Loading