Integrate task runner into python tools

This commit is contained in:
ajp_anton
2026-08-08 17:21:50 +00:00
parent f8fb1eed75
commit 56d6194324
22 changed files with 1137 additions and 7 deletions
+18
View File
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Server Maintenance{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<header>
<a href="{{ url_for('index') }}">Server Maintenance</a>
</header>
<main>
{% block content %}{% endblock %}
</main>
<script src="{{ url_for('static', filename='app.js') }}"></script>
</body>
</html>
+18
View File
@@ -0,0 +1,18 @@
{% extends "base.html" %}
{% block title %}History · Server Maintenance{% endblock %}
{% block content %}
<p><a href="{{ url_for('index') }}">← Tasks</a></p>
<h1>History: {{ target_path }}</h1>
<ul class="history">
{% for run in runs %}
<li>
<a href="{{ url_for('run_detail', run_id=run.id) }}">Run #{{ run.id }}</a>
· {{ run.status }}
· {{ run.created_at|timestamp }}
{% if run.exit_code is not none %}· exit {{ run.exit_code }}{% endif %}
</li>
{% else %}
<li>No runs yet.</li>
{% endfor %}
</ul>
{% endblock %}
+48
View File
@@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block content %}
<h1>Tasks</h1>
{% if not groups %}
<p>No task groups found.</p>
{% endif %}
{% for group in groups %}
{% set group_run = latest[("group", group.id)] %}
<section class="group">
<div class="group-heading">
<h2>{{ group.display_name }}</h2>
<form method="post" action="{{ url_for('run_group', group_id=group.id) }}">
<button type="submit">Run group</button>
</form>
</div>
{% if group_run %}
<p class="run-summary">
Group: <a href="{{ url_for('run_detail', run_id=group_run.id) }}">{{ group_run.status }}</a>
· {{ group_run.finished_at|timestamp if group_run.finished_at else "in progress" }}
</p>
{% endif %}
<ul class="tasks">
{% for task in group.tasks %}
{% set task_run = latest[("task", task.id)] %}
<li>
<div>
<h3>{{ task.display_name }}</h3>
{% if task.description %}<p>{{ task.description }}</p>{% endif %}
{% if task_run %}
<p class="run-summary">
Last run:
<a href="{{ url_for('run_detail', run_id=task_run.id) }}">{{ task_run.status }}</a>
· {{ task_run.finished_at|timestamp if task_run.finished_at else "in progress" }}
· <a href="{{ url_for('history', target_kind='task', target_path=task.id) }}">history</a>
</p>
{% endif %}
</div>
<form method="post" action="{{ url_for('run_task', task_id=task.id) }}">
<button type="submit">Run</button>
</form>
</li>
{% else %}
<li>No exposed tasks in this group.</li>
{% endfor %}
</ul>
</section>
{% endfor %}
{% endblock %}
+29
View File
@@ -0,0 +1,29 @@
{% extends "base.html" %}
{% block title %}Run {{ run.id }} · Server Maintenance{% endblock %}
{% block content %}
<p><a href="{{ url_for('index') }}">← Tasks</a></p>
<h1>{{ run.target_kind|title }} run #{{ run.id }}</h1>
<dl>
<dt>Target</dt><dd>{{ run.target_path }}</dd>
<dt>Status</dt><dd id="run-status" data-state-url="{{ url_for('run_state', run_id=run.id) }}">{{ run.status }}</dd>
<dt>Started</dt><dd>{{ run.started_at|timestamp }}</dd>
<dt>Finished</dt><dd>{{ run.finished_at|timestamp }}</dd>
<dt>Exit code</dt><dd>{{ run.exit_code if run.exit_code is not none else "—" }}</dd>
{% if run.message %}<dt>Message</dt><dd>{{ run.message }}</dd>{% endif %}
</dl>
{% if run.status in ("queued", "running") %}
<form method="post" action="{{ url_for('cancel_run', run_id=run.id) }}">
<button type="submit">Cancel</button>
</form>
{% endif %}
{% if children %}
<h2>Group tasks</h2>
<ul>
{% for child in children %}
<li><a href="{{ url_for('run_detail', run_id=child.id) }}">{{ child.target_path }}</a> · {{ child.status }}</li>
{% endfor %}
</ul>
{% endif %}
<h2>Output</h2>
<pre id="run-output" data-output-url="{{ url_for('run_output', run_id=run.id) }}"></pre>
{% endblock %}