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
9 changes: 7 additions & 2 deletions app/nullius/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@

_WORD = re.compile(r'([A-Za-z_][A-Za-z0-9_]*)=("(?:[^"\\]|\\.)*"|\S*)')
_BARE = re.compile(r'^[^\s"=]+$')
# an image digest, shown short as ``docker images`` does: its first 12 hex
_DIGEST = re.compile(r"(sha256:[0-9a-f]{12})[0-9a-f]{52}")


def _value(v) -> str:
Expand Down Expand Up @@ -269,13 +271,16 @@ def fold(events: Iterable[dict]) -> dict:
if key != st and st in stages and stages[st]["state"] == "waiting":
stages = {(key if k == st else k): v for k, v in stages.items()}
stages[key]["key"] = key
stages.setdefault(key, {"key": key, "stage": st, "label": label(ev), "state": "waiting"})
stages.setdefault(key, {"key": key, "stage": st, "state": "waiting"})
row = stages[key]
if state == "start":
# A later part or retry starts this stage afresh.
for field in ("seconds", "bytes", "total", "detail"):
row.pop(field, None)
row["label"] = label(ev)
full = label(ev)
row["label"] = _DIGEST.sub(r"\1", full)
if row["label"] != full:
row["full"] = full
if ev.get("detail") is not None:
row["detail"] = ev["detail"]
if state == "start":
Expand Down
6 changes: 6 additions & 0 deletions app/static/runs/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@
r.style.transition = 'transform .28s var(--ease)'; r.style.transform = ''; });
}));

// a split that would open past the window's right edge (a narrow screen) opens leftwards instead
$$('.pop', page).forEach(d => d.addEventListener('toggle', () => {
const m = $('.popm', d); m.style.left = m.style.right = '';
if (d.open && m.getBoundingClientRect().right > innerWidth) Object.assign(m.style, {left: 'auto', right: '0'});
}));

// ---- Esc closes what is open, else clears the filters ----
document.addEventListener('keydown', e => {
if (e.key !== 'Escape') return;
Expand Down
15 changes: 11 additions & 4 deletions app/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,11 @@ button.seg:hover { filter: brightness(1.25); }
.wf-tick:first-child { transform: none; }
.wf-tick:last-child { transform: translateX(-100%); }
.wf-head .wf-dur { text-align: right; }
/* a phone: the name column gives way, and the axis keeps its first and last ticks */
@media (max-width: 640px) {
.wf-head, .wf-row { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) 5.5rem; }
.wf-tick:not(:first-child):not(:last-child) { display: none; }
}

.wf-row { height: 24px; position: relative; }
.wf-row:hover { background: var(--surface-2); }
Expand Down Expand Up @@ -1699,8 +1704,9 @@ pre.instruction { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32
.execution-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.run-delete { margin-left: auto; color: var(--text-dim); }
.execution-stages { container: xs / inline-size; margin: 14px 0 8px; }
.xs-list { --mark: 1.6rem; list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-start; }
.xs { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding-right: .9rem; font-size: .82rem; line-height: 1.3; color: var(--text-dim); }
/* more stages than the width holds scroll inside the strip, never the page; the padding keeps the running mark's ring unclipped */
.xs-list { --mark: 1.6rem; list-style: none; margin: -6px; padding: 6px; display: flex; align-items: flex-start; overflow-x: auto; }
.xs { position: relative; flex: 1 1 0; min-width: 7rem; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding-right: .9rem; font-size: .82rem; line-height: 1.3; color: var(--text-dim); }
.xs:last-child { flex: 0 1 auto; padding-right: 0; }
.xs::before { content: ""; position: absolute; top: calc(var(--mark) / 2 - 1px); left: calc(var(--mark) + .4rem); right: .4rem; height: 2px; border-radius: 1px; background: var(--border-soft); transition: background .3s; }
.xs:last-child::before { display: none; }
Expand All @@ -1714,9 +1720,10 @@ pre.instruction { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32
.xs.running { color: var(--text); font-weight: 500; }
.xs.waiting { color: var(--text-faint); }
.xs-time { font-family: var(--mono); font-size: .75rem; font-weight: 400; color: var(--text-faint); }
.xs-detail { font-size: .75rem; font-weight: 400; color: var(--text-faint); overflow-wrap: anywhere; }
.xs-detail { font-size: .75rem; font-weight: 400; color: var(--text-faint); }
.xs-label, .xs-detail { overflow-wrap: anywhere; }
@container xs (max-width: 44rem) {
.xs-list { flex-direction: column; }
.xs-list { flex-direction: column; margin: 0; padding: 0; overflow: visible; }
.xs, .xs:last-child { flex: none; width: 100%; min-height: var(--mark); padding: .1rem 0 .95rem calc(var(--mark) + .7rem); }
.xs:last-child { padding-bottom: 0; }
.xs::before { top: calc(var(--mark) + .3rem); bottom: .3rem; left: calc(var(--mark) / 2 - 1px); right: auto; width: 2px; height: auto; }
Expand Down
4 changes: 2 additions & 2 deletions app/templates/runs/_execution.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{% set sp = ex.stages() %}
<div class="execution-stages" id="execution-stages"{% if not sp.stages and not sp.units %} hidden{% endif %}>
<ol class="xs-list" id="execution-stage-list">{% for st in sp.stages %}
<li class="xs {{ st.state }}"{% if st.detail %} title="{{ st.detail }}"{% endif %}{% if st.state == 'running' %} aria-current="step"{% endif %}><i aria-hidden="true">{{ '' if st.state in ('done', 'cached') else '✕' if st.state == 'failed' else loop.index }}</i><span class="xs-label">{{ st.label }}</span>
<li class="xs {{ st.state }}"{% if st.detail %} title="{{ st.detail }}"{% endif %}{% if st.state == 'running' %} aria-current="step"{% endif %}><i aria-hidden="true">{{ '' if st.state in ('done', 'cached') else '✕' if st.state == 'failed' else loop.index }}</i><span class="xs-label"{% if st.full %} title="{{ st.full }}"{% endif %}>{{ st.label }}</span>
{%- if st.state == 'cached' %}<span class="xs-time">cached</span>{% elif st.get('seconds') is not none and st.state in ('done', 'failed') %}<span class="xs-time">{{ st.seconds|secs }}</span>{% endif %}
{%- if st.state in ('running', 'failed') and st.detail and st.detail != sp.detail %}<span class="xs-detail">{{ st.detail }}</span>{% endif %}</li>{% endfor %}
</ol>
Expand Down Expand Up @@ -60,7 +60,7 @@
if (!mark) { mark = el('i'); mark.setAttribute('aria-hidden', 'true'); li.append(mark); }
mark.textContent = {done: '', cached: '', failed: '✕'}[st.state] ?? String(n + 1);
while (mark.nextSibling) mark.nextSibling.remove();
li.append(el('span', 'xs-label', st.label));
const name = li.appendChild(el('span', 'xs-label', st.label)); if (st.full) name.title = st.full;
if (st.state === 'cached') li.append(el('span', 'xs-time', 'cached'));
else if (st.state === 'running' && st.t) li.append(el('span', 'xs-time', clock(Math.max(0, Date.now() / 1000 - st.t))));
else if (st.seconds != null && (st.state === 'done' || st.state === 'failed')) li.append(el('span', 'xs-time', secs(st.seconds)));
Expand Down
6 changes: 6 additions & 0 deletions app/tests/test_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ def test_a_planned_stage_said_with_what_it_is_of_takes_its_place(self):
got = progress.fold([ev("plan", stages="install,units"), ev("install", "start", agent="codex@2.2.2")])
self.assertEqual([(s["key"], s["label"]) for s in got["stages"]], [("install:codex@2.2.2", "Install codex@2.2.2"), ("units", "Units")])

def test_an_image_digest_is_shown_short_with_the_full_label_kept(self):
digest = "sha256:" + "0123456789ab" + "c" * 52
got = progress.fold([ev("environment", "start", name="tasks@" + digest), ev("install", "start", agent="terminus-2")])
self.assertEqual([(s["label"], s.get("full")) for s in got["stages"]],
[("Environment tasks@sha256:0123456789ab", "Environment tasks@" + digest), ("Install terminus-2", None)])

def test_a_planned_stage_a_later_one_overtook_was_not_needed(self):
got = progress.fold([ev("plan", stages="image,dataset,install"), ev("image", "cached"), ev("install", "start", agent="a")])
self.assertEqual([s["stage"] for s in got["stages"]], ["image", "install"])
Expand Down
Loading