Add task status to tasks page
This commit is contained in:
@@ -42,6 +42,14 @@ async function pollTask(poll_url, disableTimeout) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
if (res && res.status) {
|
||||
let status = res.status.toLowerCase();
|
||||
if (status === "pending") {
|
||||
status = "pending or unknown";
|
||||
}
|
||||
document.getElementById("status").textContent = `Status: ${status}`;
|
||||
}
|
||||
|
||||
if (res && res.status === "SUCCESS") {
|
||||
console.log("Got result")
|
||||
return res.result;
|
||||
|
||||
@@ -64,7 +64,7 @@ class FlaskCelery(Celery):
|
||||
|
||||
def make_celery(app):
|
||||
celery = FlaskCelery(app.import_name, backend=app.config['CELERY_RESULT_BACKEND'],
|
||||
broker=app.config['CELERY_BROKER_URL'])
|
||||
broker=app.config['CELERY_BROKER_URL'], task_track_started=True)
|
||||
|
||||
celery.init_app(app)
|
||||
return celery
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ self.title() }}</h1>
|
||||
<p id="status"></p>
|
||||
|
||||
{% if "error" in info or info.status == "FAILURE" or info.status == "REVOKED" %}
|
||||
<pre style="white-space: pre-wrap; word-wrap: break-word;">{{ info.error }}</pre>
|
||||
{% else %}
|
||||
<script src="/static/js/polltask.js"></script>
|
||||
<script src="/static/js/polltask.js?v=2"></script>
|
||||
<script>
|
||||
// @author rubenwardy
|
||||
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
|
||||
|
||||
Reference in New Issue
Block a user