OXYGENHUB
# bb018142cca7 oxygenhub / templates / admin_runners.html
8.0 KiB · HTML · last changed Flow priorities: site, organisation and repository levels, and expediting a run 19 days ago source blame history raw
1
{% extends "base.html" %}
2
{% block title %}Runners · Administration{% endblock %}
3
{% block mainclass %} class="wide"{% endblock %}
4
{% block content %}
5
<div class="head"><h1>Runners <small>{{ runners.len()|plural("runner", "runners") }} · <a href="/admin">Administration</a></small></h1></div>
6
<div class="bar"><span class="modes"><a href="/admin/runners" class="on">runners</a><a href="/admin/runners/images">images</a><a href="/admin/runners/settings">settings</a></span></div>
7
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %}
8
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %}
9
{% if let Some(t) = new_token %}
10
<section class="panel strip ok">
11
  <h2>Registration token</h2>
12
  <p>Use it once, within a day, on the machine that will run jobs. It is shown only now.</p>
13
  <pre class="snippet">flow runner register {{ hub }} --token {{ t }} --name NAME [--ca hub-ca.pem] [--label LABEL]
14
flow runner</pre>
15
  <p class="small mute">The runner sends its signing identity when it registers; this hub accepts receipts from it signed by that key only.</p>
16
</section>
17
{% endif %}
18
<section class="panel">
19
  {% if runners.is_empty() %}<p class="mute">No runners yet. Create a registration token below and run <code>flow runner register</code> on the runner.</p>{% else %}
20
  <div class="table"><table>
21
  <tr><th>Runner</th><th>Connectivity</th><th>Status</th><th>Serves</th><th>Signing key</th><th>Machine</th><th>Labels</th><th>Capacity</th><th>Last seen</th><th></th></tr>
22
  {% for row in runners %}{% let r = row.r %}
23
  <tr>
24
    <td><a href="/admin/runners/{{ r.id }}"><strong>{{ r.name }}</strong></a>{% if r.source == "config" %} <span class="tag" title="Configured with a hub.toml token">hub.toml</span>{% endif %}</td>
25
    <td><span class="runner-status st-{{ r.connectivity() }}">{{ r.connectivity() }}</span></td>
26
    <td class="small"><a href="/admin/runners?runner={{ r.name|urlencode }}#queue" title="{% if row.jobs.is_empty() %}Its jobs in the queue{% else %}{{ row.jobs_line() }}{% endif %}">{{ row.doing() }}</a></td>
27
    <td class="small">{{ row.scope }}
28
      <form class="tiny" method="post" action="/admin/runners/{{ r.id }}/scope" title="Empty for the whole site, an owner, or owner/repository"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="text" name="scope" size="14" placeholder="owner or owner/repo"> <button>set</button></form></td>
29
    <td>{% if r.key.is_empty() %}<span class="mute" title="Bound on its first signed receipt">not yet</span>{% else %}<code title="{{ r.key }} · {{ r.key_name }}">{{ r.key|short }}</code>{% endif %}</td>
30
    <td class="small">{% if r.arch.is_empty() %}<span class="mute">unknown</span>{% else %}{{ r.arch }} · {{ r.os }} · flow {{ r.version }}{% endif %}{% let f = r.facts_line() %}{% if !f.is_empty() %}<br><span class="mute" title="Measured by the runner at its last claim{% if !r.kernel.is_empty() %}; kernel {{ r.kernel }}{% endif %}">{{ f }}</span>{% endif %}{% if !row.swarm.is_empty() %}<br><span class="mute" title="Where other runners fetch image chunks from it">swarm {{ row.swarm }}</span>{% endif %}</td>
31
    <td class="small">{% for l in r.label_list() %}<span class="lbl">{{ l }}</span> {% endfor %}</td>
32
    <td class="small">{{ r.max_jobs|plural("job", "jobs") }}{% if let Some(m) = r.memory_mib %} · {{ m }} MiB{% endif %}{% if let Some(c) = r.cpus %} · {{ c }} vCPU{% endif %}</td>
33
    <td class="small">{% if let Some(t) = r.last_seen_ms %}<time title="{{ t|when_i }}">{{ t|ago_i }}</time>{% else %}<span class="mute">never</span>{% endif %}</td>
34
    <td><form class="tiny" method="post" action="/admin/runners/{{ r.id }}/state"><input type="hidden" name="_csrf" value="{{ shell.csrf }}">
35
      {% if r.state == "active" %}<button name="state" value="draining" title="Finish current jobs, take no new ones">drain</button> <button name="state" value="disabled" title="Refuse its requests at once">disable</button>{% else %}<button name="state" value="active">resume</button>{% endif %}</form>
36
      <form class="tiny" method="post" action="/admin/runners/{{ r.id }}/remove" onsubmit="return confirm('Remove {{ r.name }}? Its credential stops working; its jobs keep its name.')"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button class="danger-btn">remove</button></form></td>
37
  </tr>
38
  {% endfor %}
39
  </table></div>
40
  {% endif %}
41
</section>
42
<section class="panel" id="queue">
43
  <h2>Queue <small>{% if filter.any() %}{{ queue.len() }} of {{ queue_total }} · <a href="/admin/runners#queue">all</a>{% else %}{{ queue_total|plural("job", "jobs") }}{% endif %}</small></h2>
44
  <form class="filters" method="get" action="/admin/runners#queue">
45
    <select name="repo" aria-label="Repository"><option value="">every repository</option>{% for r in queue_repos %}<option{% if *r == filter.repo %} selected{% endif %}>{{ r }}</option>{% endfor %}</select>
46
    <select name="status" aria-label="Status"><option value="">running and queued</option><option value="running"{% if filter.status == "running" %} selected{% endif %}>running</option><option value="queued"{% if filter.status == "queued" %} selected{% endif %}>queued</option></select>
47
    <select name="runner" aria-label="Runner"><option value="">every runner</option>{% for r in queue_runners %}<option{% if *r == filter.runner %} selected{% endif %}>{{ r }}</option>{% endfor %}{% if !filter.runner.is_empty() && !queue_runners.contains(filter.runner) %}<option selected>{{ filter.runner }}</option>{% endif %}</select>
48
    <button>filter</button>
49
  </form>
50
  {% if queue.is_empty() %}<p class="mute small">{% if filter.any() %}Nothing matches.{% else %}Nothing running or waiting.{% endif %}</p>{% else %}
51
  <div class="table"><table>
52
  <tr><th>Repository</th><th>Run</th><th>Job</th><th>Status</th><th>Priority</th><th>Started</th><th>Runner</th></tr>
53
  {% for q in queue %}<tr><td><a href="/{{ q.owner }}/{{ q.name }}">{{ q.owner }}/{{ q.name }}</a></td><td><a href="/{{ q.owner }}/{{ q.name }}/flow/{{ q.run_number }}">#{{ q.run_number }}</a></td><td>{{ q.job }}</td><td>{{ q.status }}</td><td class="small"{% if !q.priority_note.is_empty() %} title="{{ q.priority_note }}"{% endif %}>{% if q.priority() == "normal" %}<span class="mute">normal</span>{% else %}<span class="tag">{{ q.priority() }}</span>{% endif %}</td><td class="small">{% if let Some(t) = q.started_ms %}<time title="{{ t|when_i }}">{{ t|ago_i }}</time>{% endif %}</td><td>{% if q.runner.is_empty() %}<span class="mute">waiting{% let needs = q.needs() %}{% if !needs.is_empty() %} for a runner with {% for l in needs %}<span class="lbl">{{ l }}</span> {% endfor %}{% endif %}{% if let Some(a) = q.arch() %} on <span class="lbl">{{ a }}</span>{% endif %}</span>{% else %}<a href="/admin/runners?runner={{ q.runner|urlencode }}#queue">{{ q.runner }}</a>{% endif %}</td></tr>{% endfor %}
54
  </table></div>
55
  <p class="small mute">Queued jobs are in the order runners claim them: repositories take turns, a repository with jobs running waiting behind those without; a job waits for its dependencies and for a runner whose scope, tier and room fit it.</p>
56
  {% endif %}
57
</section>
58
<section class="panel">
59
  <h2>Add a runner</h2>
60
  <p class="small">A runner registers with a one-time token: it sends its signing identity, architecture and labels, and gets its own credential, kept in <code>runner.toml</code> beside its <code>flow.toml</code>.</p>
61
  <p class="small">The runner serves the whole site, one owner's repositories, or one repository; it never takes another scope's jobs.</p>
62
  <form method="post" action="/admin/runners/token"><input type="hidden" name="_csrf" value="{{ shell.csrf }}">
63
    <label for="scope">Serves (empty for the whole site, an owner, or owner/repository)</label>
64
    <input type="text" id="scope" name="scope" placeholder="andymccall or andymccall/oxygen">
65
    <button type="submit" class="primary-btn">Create a registration token</button></form>
66
  {% if !pending.is_empty() %}<p class="small mute">Unused tokens: {% for (by, made, expires) in pending %}by {{ by }} {{ made|ago_i }}, expires {{ expires|when_i }}{% if !loop.last %}; {% endif %}{% endfor %}</p>{% endif %}
67
</section>
68
{% endblock %}