diff --git a/rq_mantis/app.py b/rq_mantis/app.py index a1db146..0bdf28e 100644 --- a/rq_mantis/app.py +++ b/rq_mantis/app.py @@ -8,6 +8,7 @@ from flask import url_for from redis import from_url, ConnectionError from rq import get_failed_queue +from rq.job import Job from werkzeug.exceptions import ServiceUnavailable from rq_mantis.utils import WorkersChecker, get_queues_data @@ -109,7 +110,10 @@ def queue_empty(name): @app.route("/queue/") def queue_detail(name): queue = get_queue_by_name(name) - running_jobs = rq.registry.StartedJobRegistry(name).get_job_ids() + running_jobs = { + Job.fetch(job_id) + for job_id in rq.registry.StartedJobRegistry(name).get_job_ids() + } return render_template('queue.html', queue=queue, running_jobs=running_jobs) diff --git a/rq_mantis/templates/queue.html b/rq_mantis/templates/queue.html index 0ded05d..b2b87c7 100644 --- a/rq_mantis/templates/queue.html +++ b/rq_mantis/templates/queue.html @@ -61,32 +61,12 @@

Enqueued

{% endfor %} -

Running jobs

- {% for job_id in running_jobs %} -
- - - - - - -
{{ job_id }}
-
- {% endfor %} + {% if running_jobs %} + {% include 'running_jobs.html' %} + {% endif %} {% elif running_jobs %} -

Running jobs

- {% for job_id in running_jobs %} -
- - - - - - -
{{ job_id }}
-
- {% endfor %} + {% include 'running_jobs.html' %} {% else %}

No jobs in queue

{% endif %} diff --git a/rq_mantis/templates/running_jobs.html b/rq_mantis/templates/running_jobs.html new file mode 100644 index 0000000..b209508 --- /dev/null +++ b/rq_mantis/templates/running_jobs.html @@ -0,0 +1,29 @@ +

Running jobs

+{% for job in running_jobs %} +
+ + + + + + + + + + + + + + + + + + + + + + + +
IDStatusNameArgsKwargsTimeoutCreated at
{{ job.id }}{{ job.status }}{{ job.func_name }}{{ job.args }}{{ job.kwargs }}{{ job.timeout }}{{ job.created_at|datetime }}
+
+{% endfor %} \ No newline at end of file