canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #03087
[Merge] ~hyask/autopkgtest-cloud:skia/package_show_queued_jobs into autopkgtest-cloud:master
Skia has proposed merging ~hyask/autopkgtest-cloud:skia/package_show_queued_jobs into autopkgtest-cloud:master.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~hyask/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/461122
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~hyask/autopkgtest-cloud:skia/package_show_queued_jobs into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/browse.cgi b/charms/focal/autopkgtest-web/webcontrol/browse.cgi
index f6be794..2918276 100755
--- a/charms/focal/autopkgtest-web/webcontrol/browse.cgi
+++ b/charms/focal/autopkgtest-web/webcontrol/browse.cgi
@@ -149,7 +149,7 @@ def get_release_arches():
return release_arches
-def get_queue_info():
+def get_queues_info():
"""Return information about queued tests
Return (releases, arches, context -> release -> arch -> (queue_size, [requests])).
@@ -280,6 +280,20 @@ def package_overview(package, _=None):
(k, v) for (k, v) in get_running_jobs().items() if k == package
)
+ (_, _, queues_info) = get_queues_info()
+ for queue_name, queue in queues_info.items():
+ for release in queue:
+ for arch in queue[release]:
+ filtered_requests = [
+ r
+ for r in queue[release][arch][1]
+ if r.startswith(package + "\n")
+ ]
+ queues_info[queue_name][release][arch] = (
+ len(filtered_requests), # update the size too
+ filtered_requests,
+ )
+
return render(
"browse-package.html",
package=package,
@@ -293,6 +307,7 @@ def package_overview(package, _=None):
results=results,
title_suffix="- %s" % package,
running=running_info,
+ queues_info=queues_info,
)
@@ -368,19 +383,15 @@ def package_release_arch(package, release, arch, _=None):
@app.route("/running")
def running():
- (releases, arches, queue_info) = get_queue_info()
- queue_lengths = {}
- for c in queue_info:
+ (releases, arches, queues_info) = get_queues_info()
+ queues_lengths = {}
+ for c in queues_info:
for r in releases:
for a in arches:
- # pylint: disable=unused-variable
- (
- queue_length,
- queue_items,
- ) = (
- queue_info.get(c, {}).get(r, {}).get(a, (0, []))
+ (queue_length, _) = (
+ queues_info.get(c, {}).get(r, {}).get(a, (0, []))
)
- queue_lengths.setdefault(c, {}).setdefault(r, {})[
+ queues_lengths.setdefault(c, {}).setdefault(r, {})[
a
] = queue_length
@@ -388,11 +399,10 @@ def running():
return render(
"browse-running.html",
- contexts=queue_info.keys(),
releases=releases,
arches=arches,
- queue_info=queue_info,
- queue_lengths=queue_lengths,
+ queues_info=queues_info,
+ queues_lengths=queues_lengths,
running=running_info,
)
@@ -411,7 +421,7 @@ def admin():
@app.route("/queue_size.json")
def queuesize_json():
- queue_info = get_queue_info()[2]
+ queue_info = get_queues_info()[2]
# Strip the number of queue items, this is just their contents
for context in queue_info: # pylint: disable=consider-using-dict-items
for release in queue_info[context]:
@@ -426,7 +436,7 @@ def queuesize_json():
@app.route("/queues.json")
def queues_json():
- queue_info = get_queue_info()[2]
+ queue_info = get_queues_info()[2]
# Strip the number of queue items, this is just their contents
for context in queue_info: # pylint: disable=consider-using-dict-items
for release in queue_info[context]:
diff --git a/charms/focal/autopkgtest-web/webcontrol/helpers/tests.py b/charms/focal/autopkgtest-web/webcontrol/helpers/tests.py
index 3e61e8c..504e855 100644
--- a/charms/focal/autopkgtest-web/webcontrol/helpers/tests.py
+++ b/charms/focal/autopkgtest-web/webcontrol/helpers/tests.py
@@ -15,15 +15,25 @@ def populate_dummy_db(db_con):
(3, supported_releases[0], "ppc64el", "hello"),
(4, supported_releases[1], "ppc64el", "hello"),
(5, supported_releases[2], "amd64", "hello"),
+ (6, supported_releases[2], "amd64", "hello2"),
+ (7, supported_releases[2], "arm64", "hello2"),
+ (8, supported_releases[3], "amd64", "hello2"),
+ (9, supported_releases[3], "arm64", "hello2"),
]
c.executemany("INSERT INTO test values(?, ?, ?, ?)", tests)
results = [
# fmt: off
# test_id | run_id | version | trigger | duration | exit_code | requester | env | uuid
(1, datetime.now(), "1.2.3", "hello/1.2.3", 42, 0, "hyask", "", str(uuid4())),
- (1, datetime.now(), "1.2.3", "hello/1.2.3", 42, 0, "hyask", "all-proposed=1", str(uuid4())),
- (2, datetime.now(), "1.2.3", "hello/1.2.3", 42, 0, "", "", str(uuid4())),
- (3, datetime.now(), "1.2.3", "hello/1.2.3", 42, 20, "", "", str(uuid4())),
+ (1, datetime.now(), "1.2.3", "hello/1.2.3", 42, 2, "hyask", "all-proposed=1", str(uuid4())),
+ (2, datetime.now(), "1.2.3", "hello/1.2.3", 42, 4, "", "", str(uuid4())),
+ (3, datetime.now(), "1.2.3", "hello/1.2.3", 42, 6, "", "", str(uuid4())),
+ (4, datetime.now(), "1.2.3", "hello/1.2.3", 42, 8, "", "", str(uuid4())),
+ (5, datetime.now(), "1.2.3", "hello/1.2.3", 42, 12, "", "", str(uuid4())),
+ (6, datetime.now(), "2.0.0", "hello/1.2.3", 142, 14, "", "", str(uuid4())),
+ (7, datetime.now(), "2.0.0", "hello/1.2.3", 142, 16, "", "", str(uuid4())),
+ (8, datetime.now(), "2.0.0", "hello/1.2.3", 142, 20, "", "", str(uuid4())),
+ (9, datetime.now(), "2.0.0", "hello/1.2.3", 142, 0, "", "", str(uuid4())),
# fmt: on
]
c.executemany(
diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/browse-package.html b/charms/focal/autopkgtest-web/webcontrol/templates/browse-package.html
index a313617..65d14de 100644
--- a/charms/focal/autopkgtest-web/webcontrol/templates/browse-package.html
+++ b/charms/focal/autopkgtest-web/webcontrol/templates/browse-package.html
@@ -26,4 +26,7 @@
{% for p, info in running.items()|sort %}
{{ macros.display_running_job(p, info) }}
{% endfor %}
+
+ <h3>Queued tests</h3>
+ {{ macros.display_queues_info(queues_info) }}
{% endblock %}
diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/browse-running.html b/charms/focal/autopkgtest-web/webcontrol/templates/browse-running.html
index c876a22..86e555b 100644
--- a/charms/focal/autopkgtest-web/webcontrol/templates/browse-running.html
+++ b/charms/focal/autopkgtest-web/webcontrol/templates/browse-running.html
@@ -9,7 +9,7 @@
{% for column in running|sort|batch(3) %}
<tr>
{% for p in column %}
- <td><a href="#pkg-{{p}}">{{p}}</a></td>
+ <td><a href="#pkg-{{ p }}">{{ p }}</a></td>
{% endfor %}
</tr>
{% endfor %}
@@ -19,18 +19,18 @@
<p>Click on the number in a cell to jump to the list of test requests for
that release and architecture which are waiting to be run.</p>
- {% for context in ["ubuntu", "huge", "ppa", "upstream"] %}
+ {% for context in queues_info.keys() %}
<table class="table-condensed table-striped" style="display: inline-block; padding-right: 30px">
<tr>
- <th>{{context}}</th>
- {% for a in arches %}<th>{{a}}</th>{% endfor %}
+ <th>{{ context }}</th>
+ {% for a in arches %}<th>{{ a }}</th>{% endfor %}
</tr>
{% for r in releases %}
<tr>
- <td>{{r}}</td>
+ <td>{{ r }}</td>
{% for a in arches %}
- <td>{% if queue_lengths[context][r][a] %}<a href="#queue-{{context}}-{{r}}-{{a}}">{{queue_lengths[context][r][a]}} {% else %}-{% endif %}</td>
+ <td>{% if queues_lengths[context][r][a] %}<a href="#queue-{{ context }}-{{ r }}-{{ a }}">{{ queues_lengths[context][r][a] }}</a>{% else %}-{% endif %}</td>
{% endfor %}
</tr>
{% endfor %}
@@ -44,27 +44,6 @@
{% endfor %}
<!-- queue contents -->
-
- {% for context in contexts %}
- {% for r in queue_info[context] %}
- {% for a in queue_info[context][r] %}
- {% if queue_info[context][r][a] %}
- {% set (nreqs, reqs) = queue_info[context][r][a] %}
- {% if nreqs > 0 %}
- <table class="table-condensed table-striped" id="queue-{{context}}-{{r}}-{{a}}">
- <thead>
- <tr><th class="sticky-table-headers"><h3>Queued tests for {{context}} {{r}} {{a}}</h3></th></tr>
- </thead>
- <tbody>
- {% for req in reqs %}
- <tr><td>{{req}}</td></tr>
- {% endfor %}
- {% endif %}
- </tbody>
- </table>
- {% endif %}
- {% endfor %}
- {% endfor %}
- {% endfor %}
+ {{ macros.display_queues_info(queues_info) }}
{% endblock %}
diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/macros.html b/charms/focal/autopkgtest-web/webcontrol/templates/macros.html
index 244d64b..77400c8 100644
--- a/charms/focal/autopkgtest-web/webcontrol/templates/macros.html
+++ b/charms/focal/autopkgtest-web/webcontrol/templates/macros.html
@@ -24,3 +24,27 @@
<hr>
{% endfor %}
{%- endmacro %}
+
+{% macro display_queues_info(queues_info) -%}
+ {% for queue_name in queues_info.keys() -%}
+ {% for r in queues_info[queue_name] -%}
+ {% for a in queues_info[queue_name][r] -%}
+ {% if queues_info[queue_name][r][a] -%}
+ {% set (nreqs, reqs) = queues_info[queue_name][r][a] %}
+ {%- if nreqs > 0 %}
+ <table class="table-condensed table-striped" id="queue-{{ queue_name }}-{{ r }}-{{ a }}">
+ <thead>
+ <tr><th class="sticky-table-headers"><h3>Queued tests for {{ queue_name }} {{ r }} {{ a }}</h3></th></tr>
+ </thead>
+ <tbody>
+ {% for req in reqs %}
+ <tr><td>{{ req }}</td></tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ {% endif %}
+ {% endif %}
+ {%- endfor %}
+ {%- endfor %}
+ {%- endfor %}
+{%- endmacro %}