Merge ~hyask/autopkgtest-cloud:skia/improve_browsing into autopkgtest-cloud:master
- Git
- lp:~hyask/autopkgtest-cloud
- skia/improve_browsing
- Merge into master
Proposed by
Skia
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | df949e5544820f195b5094b402dd6d0f97a2ef8a | ||||
Proposed branch: | ~hyask/autopkgtest-cloud:skia/improve_browsing | ||||
Merge into: | autopkgtest-cloud:master | ||||
Diff against target: |
372 lines (+90/-88) 10 files modified
charms/focal/autopkgtest-web/charmcraft.yaml (+1/-0) charms/focal/autopkgtest-web/reactive/autopkgtest_web.py (+0/-14) charms/focal/autopkgtest-web/webcontrol/browse.cgi (+25/-23) charms/focal/autopkgtest-web/webcontrol/helpers/utils.py (+18/-2) charms/focal/autopkgtest-web/webcontrol/static/bootstrap (+1/-0) charms/focal/autopkgtest-web/webcontrol/templates/browse-admin.html (+4/-19) charms/focal/autopkgtest-web/webcontrol/templates/browse-layout.html (+5/-5) charms/focal/autopkgtest-web/webcontrol/templates/browse-package.html (+6/-0) charms/focal/autopkgtest-web/webcontrol/templates/browse-running.html (+4/-25) charms/focal/autopkgtest-web/webcontrol/templates/macros.html (+26/-0) |
||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Andersson | Approve | ||
Review via email: mp+461022@code.launchpad.net |
Commit message
Description of the change
A bit of refactor to bring the feature of displaying currently running jobs on each package's page.
To post a comment you must log in.
Revision history for this message
Tim Andersson (andersson123) wrote : | # |
Revision history for this message
Tim Andersson (andersson123) wrote : | # |
still going to review though
Revision history for this message
Tim Andersson (andersson123) wrote : | # |
lbjsbootstrap changes to be tested in staging before deployment
Revision history for this message
Tim Andersson (andersson123) wrote : | # |
Skia to implement new Exceptions in helpers/
Also implement all exception handler in browse.cgi for extendability.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/charms/focal/autopkgtest-web/charmcraft.yaml b/charms/focal/autopkgtest-web/charmcraft.yaml | |||
2 | index 93c0816..546437f 100644 | |||
3 | --- a/charms/focal/autopkgtest-web/charmcraft.yaml | |||
4 | +++ b/charms/focal/autopkgtest-web/charmcraft.yaml | |||
5 | @@ -6,6 +6,7 @@ parts: | |||
6 | 6 | build-snaps: [charm] | 6 | build-snaps: [charm] |
7 | 7 | build-packages: | 7 | build-packages: |
8 | 8 | - libjs-jquery | 8 | - libjs-jquery |
9 | 9 | - libjs-bootstrap | ||
10 | 9 | - python3-dev | 10 | - python3-dev |
11 | 10 | bases: | 11 | bases: |
12 | 11 | - build-on: | 12 | - build-on: |
13 | diff --git a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py | |||
14 | index e1be1a2..6920fc1 100644 | |||
15 | --- a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py | |||
16 | +++ b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py | |||
17 | @@ -338,20 +338,6 @@ def clear_github_status_credentials(): | |||
18 | 338 | pass | 338 | pass |
19 | 339 | 339 | ||
20 | 340 | 340 | ||
21 | 341 | @when_not("autopkgtest-web.bootstrap-symlinked") | ||
22 | 342 | def symlink_bootstrap(): | ||
23 | 343 | try: | ||
24 | 344 | os.symlink( | ||
25 | 345 | os.path.join( | ||
26 | 346 | os.path.sep, "usr", "share", "javascript", "bootstrap" | ||
27 | 347 | ), | ||
28 | 348 | os.path.join(charm_dir(), "webcontrol", "static", "bootstrap"), | ||
29 | 349 | ) | ||
30 | 350 | set_flag("autopkgtest-web.bootstrap-symlinked") | ||
31 | 351 | except FileExistsError: | ||
32 | 352 | pass | ||
33 | 353 | |||
34 | 354 | |||
35 | 355 | @when_not("autopkgtest-web.runtime-dir-created") | 341 | @when_not("autopkgtest-web.runtime-dir-created") |
36 | 356 | def make_runtime_tmpfiles(): | 342 | def make_runtime_tmpfiles(): |
37 | 357 | with open("/etc/tmpfiles.d/autopkgtest-web-runtime.conf", "w") as r: | 343 | with open("/etc/tmpfiles.d/autopkgtest-web-runtime.conf", "w") as r: |
38 | diff --git a/charms/focal/autopkgtest-web/webcontrol/browse.cgi b/charms/focal/autopkgtest-web/webcontrol/browse.cgi | |||
39 | index f39b30f..f6be794 100755 | |||
40 | --- a/charms/focal/autopkgtest-web/webcontrol/browse.cgi | |||
41 | +++ b/charms/focal/autopkgtest-web/webcontrol/browse.cgi | |||
42 | @@ -10,9 +10,9 @@ import sqlite3 | |||
43 | 10 | from collections import OrderedDict | 10 | from collections import OrderedDict |
44 | 11 | from wsgiref.handlers import CGIHandler | 11 | from wsgiref.handlers import CGIHandler |
45 | 12 | 12 | ||
46 | 13 | import distro_info | ||
47 | 14 | import flask | 13 | import flask |
48 | 15 | from helpers.admin import select_abnormally_long_jobs | 14 | from helpers.admin import select_abnormally_long_jobs |
49 | 15 | from helpers.utils import get_all_releases, get_supported_releases | ||
50 | 16 | from werkzeug.middleware.proxy_fix import ProxyFix | 16 | from werkzeug.middleware.proxy_fix import ProxyFix |
51 | 17 | 17 | ||
52 | 18 | app = flask.Flask("browse") | 18 | app = flask.Flask("browse") |
53 | @@ -20,13 +20,11 @@ app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1) | |||
54 | 20 | db_con = None | 20 | db_con = None |
55 | 21 | swift_container_url = None | 21 | swift_container_url = None |
56 | 22 | 22 | ||
63 | 23 | UDI = distro_info.UbuntuDistroInfo() | 23 | ALL_UBUNTU_RELEASES = get_all_releases() |
64 | 24 | ALL_UBUNTU_RELEASES = UDI.all | 24 | SUPPORTED_UBUNTU_RELEASES = get_supported_releases() |
59 | 25 | SUPPORTED_UBUNTU_RELEASES = sorted( | ||
60 | 26 | set(UDI.supported() + UDI.supported_esm()), key=ALL_UBUNTU_RELEASES.index | ||
61 | 27 | ) | ||
62 | 28 | |||
65 | 29 | INDEXED_PACKAGES_FP = "" | 25 | INDEXED_PACKAGES_FP = "" |
66 | 26 | AMQP_QUEUE_CACHE = "/var/lib/cache-amqp/queued.json" | ||
67 | 27 | RUNNING_CACHE = "/run/amqp-status-collector/running.json" | ||
68 | 30 | 28 | ||
69 | 31 | 29 | ||
70 | 32 | def init_config(): | 30 | def init_config(): |
71 | @@ -60,6 +58,16 @@ def get_test_id(release, arch, src): | |||
72 | 60 | return None | 58 | return None |
73 | 61 | 59 | ||
74 | 62 | 60 | ||
75 | 61 | def get_running_jobs(): | ||
76 | 62 | try: | ||
77 | 63 | with open(RUNNING_CACHE) as f: | ||
78 | 64 | # package -> runhash -> release -> arch -> (params, duration, logtail) | ||
79 | 65 | running_info = json.load(f) | ||
80 | 66 | except FileNotFoundError: | ||
81 | 67 | running_info = {} | ||
82 | 68 | return running_info | ||
83 | 69 | |||
84 | 70 | |||
85 | 63 | def render(template, code=200, **kwargs): | 71 | def render(template, code=200, **kwargs): |
86 | 64 | # sort the values passed in, so that releases are in the right order | 72 | # sort the values passed in, so that releases are in the right order |
87 | 65 | try: | 73 | try: |
88 | @@ -81,7 +89,7 @@ def render(template, code=200, **kwargs): | |||
89 | 81 | flask.render_template( | 89 | flask.render_template( |
90 | 82 | template, | 90 | template, |
91 | 83 | base_url=flask.url_for("index_root"), | 91 | base_url=flask.url_for("index_root"), |
93 | 84 | static_url=flask.url_for("static", filename="/"), | 92 | static_url=flask.url_for("static", filename=""), |
94 | 85 | **kwargs | 93 | **kwargs |
95 | 86 | ), | 94 | ), |
96 | 87 | code, | 95 | code, |
97 | @@ -147,7 +155,7 @@ def get_queue_info(): | |||
98 | 147 | Return (releases, arches, context -> release -> arch -> (queue_size, [requests])). | 155 | Return (releases, arches, context -> release -> arch -> (queue_size, [requests])). |
99 | 148 | """ | 156 | """ |
100 | 149 | 157 | ||
102 | 150 | with open("/var/lib/cache-amqp/queued.json", "r") as json_file: | 158 | with open(AMQP_QUEUE_CACHE, "r") as json_file: |
103 | 151 | queue_info_j = json.load(json_file) | 159 | queue_info_j = json.load(json_file) |
104 | 152 | 160 | ||
105 | 153 | arches = queue_info_j["arches"] | 161 | arches = queue_info_j["arches"] |
106 | @@ -268,6 +276,10 @@ def package_overview(package, _=None): | |||
107 | 268 | arches.add(row[3]) | 276 | arches.add(row[3]) |
108 | 269 | results.setdefault(row[2], {})[row[3]] = human_exitcode(row[1]) | 277 | results.setdefault(row[2], {})[row[3]] = human_exitcode(row[1]) |
109 | 270 | 278 | ||
110 | 279 | running_info = dict( | ||
111 | 280 | (k, v) for (k, v) in get_running_jobs().items() if k == package | ||
112 | 281 | ) | ||
113 | 282 | |||
114 | 271 | return render( | 283 | return render( |
115 | 272 | "browse-package.html", | 284 | "browse-package.html", |
116 | 273 | package=package, | 285 | package=package, |
117 | @@ -280,6 +292,7 @@ def package_overview(package, _=None): | |||
118 | 280 | arches=sorted(arches), | 292 | arches=sorted(arches), |
119 | 281 | results=results, | 293 | results=results, |
120 | 282 | title_suffix="- %s" % package, | 294 | title_suffix="- %s" % package, |
121 | 295 | running=running_info, | ||
122 | 283 | ) | 296 | ) |
123 | 284 | 297 | ||
124 | 285 | 298 | ||
125 | @@ -371,12 +384,7 @@ def running(): | |||
126 | 371 | a | 384 | a |
127 | 372 | ] = queue_length | 385 | ] = queue_length |
128 | 373 | 386 | ||
135 | 374 | try: | 387 | running_info = get_running_jobs() |
130 | 375 | with open("/run/amqp-status-collector/running.json") as f: | ||
131 | 376 | # package -> runhash -> release -> arch -> (params, duration, logtail) | ||
132 | 377 | running_info = json.load(f) | ||
133 | 378 | except FileNotFoundError: | ||
134 | 379 | running_info = {} | ||
136 | 380 | 388 | ||
137 | 381 | return render( | 389 | return render( |
138 | 382 | "browse-running.html", | 390 | "browse-running.html", |
139 | @@ -391,13 +399,7 @@ def running(): | |||
140 | 391 | 399 | ||
141 | 392 | @app.route("/admin") | 400 | @app.route("/admin") |
142 | 393 | def admin(): | 401 | def admin(): |
150 | 394 | try: | 402 | running_info = get_running_jobs() |
144 | 395 | with open("/run/amqp-status-collector/running.json") as f: | ||
145 | 396 | # package -> runhash -> release -> arch -> (params, duration, logtail) | ||
146 | 397 | running_info = json.load(f) | ||
147 | 398 | except FileNotFoundError as exc: | ||
148 | 399 | running_info = {} | ||
149 | 400 | raise FileNotFoundError("running.json doesn't exist!") from exc | ||
151 | 401 | pruned_running_info = select_abnormally_long_jobs( | 403 | pruned_running_info = select_abnormally_long_jobs( |
152 | 402 | running_info, get_test_id=get_test_id, db_con=db_con | 404 | running_info, get_test_id=get_test_id, db_con=db_con |
153 | 403 | ) | 405 | ) |
154 | @@ -439,7 +441,7 @@ def queues_json(): | |||
155 | 439 | 441 | ||
156 | 440 | @app.route("/queued.json") | 442 | @app.route("/queued.json") |
157 | 441 | def return_queued_exactly(): | 443 | def return_queued_exactly(): |
159 | 442 | with open("/var/lib/cache-amqp/queued.json") as json_file: | 444 | with open(AMQP_QUEUE_CACHE) as json_file: |
160 | 443 | queue_info = json.load(json_file) | 445 | queue_info = json.load(json_file) |
161 | 444 | return queue_info | 446 | return queue_info |
162 | 445 | 447 | ||
163 | diff --git a/charms/focal/autopkgtest-web/webcontrol/helpers/utils.py b/charms/focal/autopkgtest-web/webcontrol/helpers/utils.py | |||
164 | index 58a9514..12d93b5 100644 | |||
165 | --- a/charms/focal/autopkgtest-web/webcontrol/helpers/utils.py | |||
166 | +++ b/charms/focal/autopkgtest-web/webcontrol/helpers/utils.py | |||
167 | @@ -8,6 +8,22 @@ import random | |||
168 | 8 | import sqlite3 | 8 | import sqlite3 |
169 | 9 | import time | 9 | import time |
170 | 10 | 10 | ||
171 | 11 | import distro_info | ||
172 | 12 | |||
173 | 13 | |||
174 | 14 | def get_all_releases(): | ||
175 | 15 | udi = distro_info.UbuntuDistroInfo() | ||
176 | 16 | return udi.all | ||
177 | 17 | |||
178 | 18 | |||
179 | 19 | def get_supported_releases(): | ||
180 | 20 | udi = distro_info.UbuntuDistroInfo() | ||
181 | 21 | all_ubuntu_releases = get_all_releases() | ||
182 | 22 | return sorted( | ||
183 | 23 | set(udi.supported() + udi.supported_esm()), | ||
184 | 24 | key=all_ubuntu_releases.index, | ||
185 | 25 | ) | ||
186 | 26 | |||
187 | 11 | 27 | ||
188 | 12 | def setup_key(app, path): | 28 | def setup_key(app, path): |
189 | 13 | """Create or load app.secret_key for cookie encryption.""" | 29 | """Create or load app.secret_key for cookie encryption.""" |
190 | @@ -22,10 +38,10 @@ def setup_key(app, path): | |||
191 | 22 | app.secret_key = key | 38 | app.secret_key = key |
192 | 23 | 39 | ||
193 | 24 | 40 | ||
195 | 25 | def init_db(path): | 41 | def init_db(path, **kwargs): |
196 | 26 | """Create DB if it does not exist, and connect to it""" | 42 | """Create DB if it does not exist, and connect to it""" |
197 | 27 | 43 | ||
199 | 28 | db = sqlite3.connect(path) | 44 | db = sqlite3.connect(path, **kwargs) |
200 | 29 | c = db.cursor() | 45 | c = db.cursor() |
201 | 30 | try: | 46 | try: |
202 | 31 | c.execute("PRAGMA journal_mode = WAL") | 47 | c.execute("PRAGMA journal_mode = WAL") |
203 | diff --git a/charms/focal/autopkgtest-web/webcontrol/static/bootstrap b/charms/focal/autopkgtest-web/webcontrol/static/bootstrap | |||
204 | 32 | new file mode 120000 | 48 | new file mode 120000 |
205 | index 0000000..fe0f86b | |||
206 | --- /dev/null | |||
207 | +++ b/charms/focal/autopkgtest-web/webcontrol/static/bootstrap | |||
208 | @@ -0,0 +1 @@ | |||
209 | 1 | /usr/share/javascript/bootstrap | ||
210 | 0 | \ No newline at end of file | 2 | \ No newline at end of file |
211 | diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/browse-admin.html b/charms/focal/autopkgtest-web/webcontrol/templates/browse-admin.html | |||
212 | index 5bc2459..266f584 100644 | |||
213 | --- a/charms/focal/autopkgtest-web/webcontrol/templates/browse-admin.html | |||
214 | +++ b/charms/focal/autopkgtest-web/webcontrol/templates/browse-admin.html | |||
215 | @@ -1,29 +1,14 @@ | |||
216 | 1 | {% extends "browse-layout.html" %} | 1 | {% extends "browse-layout.html" %} |
217 | 2 | {% import "macros.html" as macros %} | ||
218 | 3 | |||
219 | 2 | {% block content %} | 4 | {% block content %} |
220 | 3 | <h1 class="page-header">Admin</h1> | 5 | <h1 class="page-header">Admin</h1> |
221 | 4 | <p>Click on the package name to jump to the tests of the package for all arches/releases.</p> | 6 | <p>Click on the package name to jump to the tests of the package for all arches/releases.</p> |
222 | 5 | <p>This page is simply a bunch of heuristics filtering all running jobs to try to get the problematic ones. Feel free to come help improve the heuristics <a href="https://code.launchpad.net/~ubuntu-release/autopkgtest-cloud/+git/autopkgtest-cloud/+ref/master">here.</a></p> | 7 | <p>This page is simply a bunch of heuristics filtering all running jobs to try to get the problematic ones. Feel free to come help improve the heuristics <a href="https://code.launchpad.net/~ubuntu-release/autopkgtest-cloud/+git/autopkgtest-cloud/+ref/master">here.</a></p> |
223 | 6 | 8 | ||
224 | 7 | <!-- Running tests --> | 9 | <!-- Running tests --> |
244 | 8 | {% for p in running|sort %} | 10 | {% for p, info in running.items()|sort %} |
245 | 9 | <h2 id="pkg-{{p}}"><a href="/packages/{{p}}">{{p}}</a></h2> | 11 | {{ macros.display_running_job(p, info) }} |
227 | 10 | {% for runhash, relinfo in running[p].items() %} | ||
228 | 11 | {% for release, archinfo in relinfo.items() %} | ||
229 | 12 | {% for arch, (params, duration, logtail) in archinfo.items() %} | ||
230 | 13 | <table class="table-condensed"> | ||
231 | 14 | <tr><th>Release:</th><td>{{release}}</td></tr> | ||
232 | 15 | <tr><th>Architecture:</th><td>{{arch}}</td></tr> | ||
233 | 16 | {% for param, v in params.items() %} | ||
234 | 17 | <tr><th>{{param|capitalize}}:</th><td>{{v}}</td></tr> | ||
235 | 18 | {% endfor %} | ||
236 | 19 | <tr><th>Running for:</th><td>{{duration//3600 }}h {{duration % 3600//60}}m {{duration % 60}}s</td></tr> | ||
237 | 20 | </table> | ||
238 | 21 | <pre> | ||
239 | 22 | {{logtail}} | ||
240 | 23 | </pre> | ||
241 | 24 | {% endfor %} | ||
242 | 25 | {% endfor %} | ||
243 | 26 | {% endfor %} | ||
246 | 27 | {% endfor %} | 12 | {% endfor %} |
247 | 28 | 13 | ||
248 | 29 | {% endblock %} | 14 | {% endblock %} |
249 | diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/browse-layout.html b/charms/focal/autopkgtest-web/webcontrol/templates/browse-layout.html | |||
250 | index 0f90de3..c91457d 100644 | |||
251 | --- a/charms/focal/autopkgtest-web/webcontrol/templates/browse-layout.html | |||
252 | +++ b/charms/focal/autopkgtest-web/webcontrol/templates/browse-layout.html | |||
253 | @@ -6,9 +6,9 @@ | |||
254 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
255 | 7 | <title>Ubuntu Autopkgtest Results {{title_suffix}}</title> | 7 | <title>Ubuntu Autopkgtest Results {{title_suffix}}</title> |
256 | 8 | <!-- <link rel="icon" type="image/png" href="/debian.png"/> --> | 8 | <!-- <link rel="icon" type="image/png" href="/debian.png"/> --> |
260 | 9 | <link rel="stylesheet" type="text/css" href="{{static_url}}/bootstrap/css/bootstrap.css"/> | 9 | <link rel="stylesheet" type="text/css" href="{{static_url}}bootstrap/css/bootstrap.css"/> |
261 | 10 | <link rel="stylesheet" type="text/css" href="{{static_url}}/bootstrap/css/bootstrap-theme.css"/> | 10 | <link rel="stylesheet" type="text/css" href="{{static_url}}bootstrap/css/bootstrap-theme.css"/> |
262 | 11 | <link rel="stylesheet" type="text/css" href="{{static_url}}/style.css"/> | 11 | <link rel="stylesheet" type="text/css" href="{{static_url}}style.css"/> |
263 | 12 | </head> | 12 | </head> |
264 | 13 | <body> | 13 | <body> |
265 | 14 | <div id='wrap'> | 14 | <div id='wrap'> |
266 | @@ -44,7 +44,7 @@ | |||
267 | 44 | {% block content %}{% endblock %} | 44 | {% block content %}{% endblock %} |
268 | 45 | </div> | 45 | </div> |
269 | 46 | 46 | ||
272 | 47 | <script type="text/javascript" src="{{static_url}}/jquery/jquery.min.js"></script> | 47 | <script type="text/javascript" src="{{static_url}}jquery/jquery.min.js"></script> |
273 | 48 | <script type="text/javascript" src="{{static_url}}/bootstrap/js/bootstrap.min.js"></script> | 48 | <script type="text/javascript" src="{{static_url}}bootstrap/js/bootstrap.min.js"></script> |
274 | 49 | </body> | 49 | </body> |
275 | 50 | </html> | 50 | </html> |
276 | diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/browse-package.html b/charms/focal/autopkgtest-web/webcontrol/templates/browse-package.html | |||
277 | index 3ac81c3..fb12afa 100644 | |||
278 | --- a/charms/focal/autopkgtest-web/webcontrol/templates/browse-package.html | |||
279 | +++ b/charms/focal/autopkgtest-web/webcontrol/templates/browse-package.html | |||
280 | @@ -1,4 +1,6 @@ | |||
281 | 1 | {% extends "browse-layout.html" %} | 1 | {% extends "browse-layout.html" %} |
282 | 2 | {% import "macros.html" as macros %} | ||
283 | 3 | |||
284 | 2 | {% block content %} | 4 | {% block content %} |
285 | 3 | <h2>{{package}}</h2> | 5 | <h2>{{package}}</h2> |
286 | 4 | 6 | ||
287 | @@ -17,4 +19,8 @@ | |||
288 | 17 | </tr> | 19 | </tr> |
289 | 18 | {% endfor %} | 20 | {% endfor %} |
290 | 19 | </table> | 21 | </table> |
291 | 22 | |||
292 | 23 | {% for p, info in running.items()|sort %} | ||
293 | 24 | {{ macros.display_running_job(p, info) }} | ||
294 | 25 | {% endfor %} | ||
295 | 20 | {% endblock %} | 26 | {% endblock %} |
296 | diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/browse-running.html b/charms/focal/autopkgtest-web/webcontrol/templates/browse-running.html | |||
297 | index 3711b97..53ae2f9 100644 | |||
298 | --- a/charms/focal/autopkgtest-web/webcontrol/templates/browse-running.html | |||
299 | +++ b/charms/focal/autopkgtest-web/webcontrol/templates/browse-running.html | |||
300 | @@ -1,4 +1,6 @@ | |||
301 | 1 | {% extends "browse-layout.html" %} | 1 | {% extends "browse-layout.html" %} |
302 | 2 | {% import "macros.html" as macros %} | ||
303 | 3 | |||
304 | 2 | {% block content %} | 4 | {% block content %} |
305 | 3 | <h1 class="page-header">Currently running tests</h1> | 5 | <h1 class="page-header">Currently running tests</h1> |
306 | 4 | <p>Click on the package name to jump to the currently running tests of that package.</p> | 6 | <p>Click on the package name to jump to the currently running tests of that package.</p> |
307 | @@ -36,31 +38,8 @@ | |||
308 | 36 | {% endfor %} | 38 | {% endfor %} |
309 | 37 | 39 | ||
310 | 38 | <!-- Running tests --> | 40 | <!-- Running tests --> |
336 | 39 | {% for p in running|sort %} | 41 | {% for p, info in running.items()|sort %} |
337 | 40 | <h2 id="pkg-{{p}}"><a href="/packages/{{p}}">{{p}}</a></h2> | 42 | {{ macros.display_running_job(p, info) }} |
313 | 41 | {% for runhash, relinfo in running[p].items() %} | ||
314 | 42 | {% for release, archinfo in relinfo.items() %} | ||
315 | 43 | {% for arch, (params, duration, logtail) in archinfo.items() %} | ||
316 | 44 | <table class="table-condensed"> | ||
317 | 45 | <tr><th>Release:</th><td>{{release}}</td></tr> | ||
318 | 46 | <tr><th>Architecture:</th><td>{{arch}}</td></tr> | ||
319 | 47 | {% for param, v in params.items() %} | ||
320 | 48 | {% if param == "requester" %} | ||
321 | 49 | <tr><th>{{param|capitalize}}:</th><td><a href="https://launchpad.net/~{{v}}">{{v}}</a></td></tr> | ||
322 | 50 | {% elif param == "uuid" %} | ||
323 | 51 | <tr><th>{{param|capitalize}}:</th><td>{{v}}</td></tr> | ||
324 | 52 | {% else %} | ||
325 | 53 | <tr><th>{{param|capitalize}}:</th><td>{{v}}</td></tr> | ||
326 | 54 | {% endif %} | ||
327 | 55 | {% endfor %} | ||
328 | 56 | <tr><th>Running for:</th><td>{{duration//3600 }}h {{duration % 3600//60}}m {{duration % 60}}s</td></tr> | ||
329 | 57 | </table> | ||
330 | 58 | <pre> | ||
331 | 59 | {{logtail}} | ||
332 | 60 | </pre> | ||
333 | 61 | {% endfor %} | ||
334 | 62 | {% endfor %} | ||
335 | 63 | {% endfor %} | ||
338 | 64 | {% endfor %} | 43 | {% endfor %} |
339 | 65 | 44 | ||
340 | 66 | <!-- queue contents --> | 45 | <!-- queue contents --> |
341 | diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/macros.html b/charms/focal/autopkgtest-web/webcontrol/templates/macros.html | |||
342 | 67 | new file mode 100644 | 46 | new file mode 100644 |
343 | index 0000000..7d43d20 | |||
344 | --- /dev/null | |||
345 | +++ b/charms/focal/autopkgtest-web/webcontrol/templates/macros.html | |||
346 | @@ -0,0 +1,26 @@ | |||
347 | 1 | {% macro display_running_job(package, info) -%} | ||
348 | 2 | <h2 id="pkg-{{ package }}"><a href="/packages/{{ package }}">{{ package }}</a></h2> | ||
349 | 3 | {% for runhash, relinfo in info.items() %} | ||
350 | 4 | {% for release, archinfo in relinfo.items() %} | ||
351 | 5 | {% for arch, (params, duration, logtail) in archinfo.items() %} | ||
352 | 6 | <table class="table-condensed"> | ||
353 | 7 | <tr><th>Release:</th><td>{{ release }}</td></tr> | ||
354 | 8 | <tr><th>Architecture:</th><td>{{ arch }}</td></tr> | ||
355 | 9 | {% for param, v in params.items() %} | ||
356 | 10 | {% if param == "requester" %} | ||
357 | 11 | <tr><th>{{ param|capitalize }}:</th><td><a href="https://launchpad.net/~{{ v }}">{{ v }}</a></td></tr> | ||
358 | 12 | {% elif param == "uuid" %} | ||
359 | 13 | <tr><th>{{ param|upper }}:</th><td>{{ v }}</td></tr> | ||
360 | 14 | {% else %} | ||
361 | 15 | <tr><th>{{ param|capitalize }}:</th><td>{{ v }}</td></tr> | ||
362 | 16 | {% endif %} | ||
363 | 17 | {% endfor %} | ||
364 | 18 | <tr><th>Running for:</th><td>{{ duration//3600 }}h {{ duration % 3600//60 }}m {{ duration % 60 }}s ({{ duration }}s)</td></tr> | ||
365 | 19 | </table> | ||
366 | 20 | <pre> | ||
367 | 21 | {{ logtail }} | ||
368 | 22 | </pre> | ||
369 | 23 | {% endfor %} | ||
370 | 24 | {% endfor %} | ||
371 | 25 | {% endfor %} | ||
372 | 26 | {%- endmacro %} |
Looks like I accidentally merged this :)