Skip to content
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
5 changes: 3 additions & 2 deletions app/templates/runs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@
<a class="btn sm ghost" href="{{ url_for('import_page') }}">Import</a>
<a class="btn sm" href="{{ url_for('new_run') }}">New run</a>
</span></div>
{# Agents only: a control's trials are a check on the tasks, not results, and
are shown as their launch's task checks. #}
{# Runs and trials are agents only: a control's trials are a check on the tasks, not results.
The checks are counted apart, as each launch counts them. #}
<p class="subtitle" id="counts"
data-runs="{{ n_agent_runs }}" data-trials="{{ n_trials }}">
{{ launches|length }} launch{{ '' if launches|length == 1 else 'es' }}<span class="dot">·</span>{{ n_agent_runs }} run{{ '' if n_agent_runs == 1 else 's' }}<span class="dot">·</span>{{ n_trials }} trial{{ '' if n_trials == 1 else 's' }}
{%- if n_checks %}<span class="dot">·</span>{{ n_checks }} check{{ '' if n_checks == 1 else 's' }}{% endif %}
</p>
<p class="runs-glance" id="glance">
{%- if workspace %}<span>in <b>{{ workspace.label }}</b></span>{% endif -%}
Expand Down
13 changes: 12 additions & 1 deletion app/ui_tests/test_controls_apart.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def get(self, path):
self.assertEqual(response.status_code, 200, path)
return response.get_data(as_text=True)

def header(self, html):
return text_of(re.search(r'<p class="subtitle" id="counts".*?</p>', html, re.S).group(0))

def row(self, html, job_id):
rows = [r for r in re.findall(r'<tr [^>]*>.*?</tr>', html, re.S) if '<td data-col="run"><a href="/job/%s">' % job_id in r]
self.assertEqual(len(rows), 1, job_id)
Expand Down Expand Up @@ -112,7 +115,7 @@ def test_a_control_that_failed_before_the_verifier_is_a_setup_failure(self):
def test_the_header_the_chips_and_the_mix_bar_count_the_agent_only(self):
html = self.get("/runs")
self.assertIn('data-runs="1" data-trials="4"', html)
self.assertIn("· 1 run · 4 trials", text_of(re.search(r'<p class="subtitle" id="counts".*?</p>', html, re.S).group(0)))
self.assertEqual(self.header(html), "3 launches · 1 run · 4 trials · 2 checks")
self.assertIn('class="dataset-count">1 run<span class="dot">·</span>4 trials', html)
legend = re.search(r'<div class="legend">.*?</div>', html, re.S).group(0)
chips = dict(re.findall(r'data-outcome="([a-z_]+)"[^>]*>[^<]*<b>(\d+)</b>', legend))
Expand All @@ -121,6 +124,14 @@ def test_the_header_the_chips_and_the_mix_bar_count_the_agent_only(self):
self.assertEqual(sorted(re.findall(r'style="flex:(\d+)" data-outcome="([a-z_]+)"', bar)),
[("1", "failed_verification"), ("1", "rate_limited"), ("2", "resolved")])

def test_the_header_counts_the_checks_apart_and_only_when_there_are_some(self):
# each job is a launch of its own here: no start time is recorded
for jobs, header in (([self.nop, self.oracle], "2 launches · 0 runs · 0 trials · 2 checks"),
([self.nop], "1 launch · 0 runs · 0 trials · 1 check"),
([self.agent], "1 launch · 1 run · 4 trials")):
self.jobs = jobs
self.assertEqual(self.header(self.get("/runs")), header)

def test_a_controls_line_names_each_control_with_its_verdict(self):
# the controls are their launch's task checks: a row each at the top of its table, with its verdict
html = self.get("/runs")
Expand Down
1 change: 1 addition & 0 deletions app/web/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def index():
datasets=datasets, choices=choices, pulse=_roots_pulse(), preparing=preparing,
launches=groups, view=view, states=states,
n_checked=sum(1 for g in groups if g["checked"]),
n_checks=sum(g["n_checks"] for g in groups),
)


Expand Down
Loading