Skip to content

Commit aa22cff

Browse files
georges-armTamarChristinaArm
authored andcommitted
Async daily report.
Change-Id: I1821253709461836cf9dca2cef2db59433d46add
1 parent 2184802 commit aa22cff

File tree

4 files changed

+382
-8
lines changed

4 files changed

+382
-8
lines changed

lnt/server/reporting/dailyreport.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ def __init__(self, ts, year, month, day, num_prior_days_to_include=3,
4343
self.result_table = None
4444
self.nr_tests_table = None
4545

46-
def get_query_parameters_string(self):
46+
def get_query_parameters_string(self, sep='&', filter_machine_regex_str=None):
4747
query_params = [
4848
"{}={}".format(
4949
urllib.parse.quote_plus(query_param), urllib.parse.quote_plus(str(value)))
5050
for query_param, value in (
5151
("day_start", self.day_start_offset.seconds // 3600),
5252
("num_days", self.num_prior_days_to_include),
53-
("filter-machine-regex", self.filter_machine_regex_str),)
53+
("filter-machine-regex", filter_machine_regex_str or self.filter_machine_regex_str),)
5454
if value is not None]
5555
# Use & instead of plain & to make sure legal XML is
5656
# produced, so that the unit tests can parse the output using
5757
# python's built-in XML parser.
58-
return "&".join(query_params)
58+
return sep.join(query_params)
5959

6060
def get_key_run(self, machine, day_index):
6161
"""
@@ -80,7 +80,7 @@ def get_key_run(self, machine, day_index):
8080
# Select a key run arbitrarily.
8181
return runs[0]
8282

83-
def build(self, session):
83+
def build(self, session, partial_report=False):
8484
ts = self.ts
8585

8686
# Construct datetime instances for the report range.
@@ -151,6 +151,9 @@ def is_recent_order(r):
151151
self.reporting_machines = list(set(r.machine for r in relevant_runs))
152152
self.reporting_machines.sort(key=lambda m: m.name)
153153

154+
if partial_report:
155+
return
156+
154157
# We aspire to present a "lossless" report, in that we don't ever hide
155158
# any possible change due to aggregation. In addition, we want to make
156159
# it easy to see the relation of results across all the reporting
@@ -313,13 +316,17 @@ def find_most_recent_run_with_samples(day_nr):
313316
nr_tests_for_machine.append(nr_tests_seen)
314317
self.nr_tests_table.append((machine, nr_tests_for_machine))
315318

316-
def render(self, ts_url, only_html_body=True):
319+
def render(self, ts_url, only_html_body=True, async_report=False):
317320
# Strip any trailing slash on the testsuite URL.
318321
if ts_url.endswith('/'):
319322
ts_url = ts_url[:-1]
320323

324+
source = 'reporting/daily_report.html'
325+
if async_report:
326+
source = 'reporting/daily_report_async.html'
327+
321328
env = lnt.server.ui.app.create_jinja_environment()
322-
template = env.get_template('reporting/daily_report.html')
329+
template = env.get_template(source)
323330

324331
return template.render(
325332
report=self, styles=report_css_styles, analysis=lnt.server.reporting.analysis,

0 commit comments

Comments
 (0)