Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rq dashboard extension #1

Merged
merged 23 commits into from Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
95a286b
Adds settings for enable show jobs on reverse order, update list jobs…
ibrahim12 Jul 4, 2019
d549533
New Running Job View
ibrahim12 Jul 4, 2019
7f3a541
Show Running & Finished Jobs
ibrahim12 Jul 5, 2019
8ac3110
Fix Running job ids pagination
ibrahim12 Jul 6, 2019
90cd1d4
Hide traceback by default, toggle on click
ibrahim12 Jul 6, 2019
fc0b7df
Refactor Templates to make template management easier
ibrahim12 Jul 9, 2019
1669c58
Fix queue , state swap in js handler
ibrahim12 Jul 9, 2019
1c8651f
Fix more queue_name instead of state_name
ibrahim12 Jul 9, 2019
f3cb9af
Merge & resolve conflicts of reverse order option
ibrahim12 Jul 10, 2019
c615d11
Merge hide traceback by default
ibrahim12 Jul 10, 2019
2dc3f5c
Add development script to repo
ibrahim12 Jul 10, 2019
21e564f
Fix deleted job error
ibrahim12 Jul 10, 2019
a3ae5ae
Fix object access on serialized job
ibrahim12 Jul 10, 2019
4f09e6b
Fix html template order string, remove debug print
ibrahim12 Jul 10, 2019
ef658b8
Fixed typo
ibrahim12 Jul 10, 2019
6863825
Refresh toggle btn for each table
ibrahim12 Jul 10, 2019
d4074f3
Simplify Refresh Btn logic
ibrahim12 Jul 10, 2019
88b2f51
Remove dev scripts, Replace finished job cancel button with delete
ibrahim12 Jul 13, 2019
85dee70
Checks and validates job result json serializability
ibrahim12 Jul 16, 2019
f5e46cf
Resolve merge conflict in
ibrahim12 Jul 23, 2019
02aaa35
Merge branch 'rq_dashboard_extension' of github.com:VacaAPI/rq-dashbo…
ibrahim12 Jul 23, 2019
6c94d2f
Update settings and remove `pending` tag from failed jobs pagination …
ibrahim12 Jul 23, 2019
11debb3
Fixed merge conflict
ibrahim12 Jul 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions rq_dashboard/default_settings.py
Expand Up @@ -4,3 +4,9 @@
Not needed anymore. Kept for compatibility.
"""
DEBUG = False
RQ_DASHBOARD_WEB_BACKGROUND = "black"
RQ_DASHBOARD_DELETE_JOBS = False

RQ_DASHBOARD_JOB_SORT_ORDER = '-age'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice setting here!


RQ_DASHBOARD_JOBS_PER_PAGE = 5
7 changes: 6 additions & 1 deletion rq_dashboard/static/css/main.css
Expand Up @@ -123,7 +123,7 @@ span.loading {
color: #555;
}

#alert-fixed {
#alert-fixed, #alert-default {
position: fixed;
top: 20px;
left: 20px;
Expand All @@ -132,3 +132,8 @@ span.loading {
text-align: center;
display: none;
}


.jobs-table h1 {
text-transform: capitalize;
}
4 changes: 4 additions & 0 deletions rq_dashboard/templates/rq_dashboard/base.html
Expand Up @@ -16,6 +16,10 @@
<strong>Warning!</strong> Selection pauses information refresh
</div>

<div id="alert-default" class="alert alert-error">
<strong>Warning!</strong> <span></span>
</div>

<div class="container">

{% block content %}{% endblock %}
Expand Down
195 changes: 12 additions & 183 deletions rq_dashboard/templates/rq_dashboard/dashboard.html
@@ -1,197 +1,27 @@
{% extends "rq_dashboard/base.html" %}


{% block content %}
<div class="row" id="rq-instances-row">
<div class="span12">
<div class="section">
<h1>RQ Instances</h1>
<p class="intro">Select below the RQ instance that you want to observe.</p>
<select id="rq-instances">
</select>
</div>
</div>
</div>
<div class="row">
<div class="span6">
<div class="section">

<h1>Queues</h1>
<p class="fixed intro">This list below contains all the registered queues with the number of jobs currently
in the queue. Select a queue from above to view all jobs currently pending on the queue.</p>

<table id="queues" class="table table-bordered">
<thead>
<tr>
<th>Queue</th>
<th class="narrow">Jobs</th>
</tr>
</thead>
<tbody>
<tr data-role="loading-placeholder">
<td colspan="2">Loading...</td>
</tr>
</tbody>
</table>

<script name="queue-row" type="text/template">
<tr data-role="queue" <% if (d.name === 'failed' && d.count > 0) { %> class="failed"<% } %>>
<td><i class="icon-inbox" style="opacity: .5;"></i> <a href="<%= d.url %>"><%= d.name %></a></td>
<td class="narrow"><%= d.count %></td>
</tr>
</script>

<script name="no-queues-row" type="text/template">
<tr>
<td colspan="3">No queues.</td>
</tr>
</script>

</div>
</div>

<div class="span6">
<div class="section">

<h1>Workers</h1>

<button id="workers-btn" type="button" class="btn btn-info">Toggle workers list</button>
<p id="workers-count" class="fixed intro">No workers registered!</p>

<table id="workers" class="table table-bordered">
<thead>
<tr>
<th style="width:48px">State</th>
<th>Worker</th>
<th>Queues</th>
</tr>
</thead>
<tbody>
<tr data-role="loading-placeholder">
<td colspan="3">Loading...</td>
</tr>
</tbody>
</table>

<script name="worker-row" type="text/template">
<tr data-role="worker">
<td><i class="icon-<%= d.state %>" title="Job ID: <%= d.current_job.job_id %>&#013;&#010;Description: <%= d.current_job.description %>&#013;&#010;Created at: <%= d.current_job.created_at %>&#013;&#010;"></i></td>
<td><%= d.name %></td>
<td><%= d.queues.join(', ') %></td>
</tr>
</script>

<script name="no-workers-row" type="text/template">
<tr>
<td colspan="3">No workers.</td>
</tr>
</script>

</div>
</div>
{% include "rq_dashboard/rq_instances.html" %}
</div>

<div class="row">
<div class="span12">
<div class="section">

<h1>Jobs on <strong{% if queue.name == 'failed' %} class="failed"{% endif %}>{{ queue.name }}</strong></h1>
<p class="intro">
<a href="{{ url_for('rq_dashboard.empty_queue', queue_name=queue.name) }}" id="empty-btn"
class="btn btn-danger btn-small" style="float: right" data-toggle="tooltip"
title="Remove all jobs from this queue (<b>destructive</b>)" data-html=true><i
class="icon-trash icon-white"></i> Empty</a>
<a href="{{ url_for('rq_dashboard.compact_queue', queue_name=queue.name) }}" id="compact-btn"
class="btn btn-small" style="float: right; margin-right: 8px;" data-toggle="tooltip"
title="Remove all stale jobs from this queue (non-destructive)"><i class="icon-resize-small"></i>
Compact</a>
<a href="{{ url_for('rq_dashboard.requeue_all') }}" id="requeue-all-btn" class="btn btn-small"
style="float: right; margin-right: 8px;"><i class="icon-retweet"></i> Requeue All</a>
This list below contains all the registered jobs on queue <strong>{{ queue.name }}</strong>, sorted by
age (oldest on top).</p>

<table id="jobs" class="table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th class="narrow">Actions</th>
</tr>
</thead>
<tbody>
<tr data-role="loading-placeholder">
<td colspan="2">Loading...</td>
</tr>
</tbody>
</table>

<script name="job-row" type="text/template">
<tr data-role="job" data-job-id="<%= d.id %>">
<td>
<i class="icon-file" style="opacity: .5;"></i>
<span class="description"><%= $('<div/>').text(d.description).html() %></span>
<% if (d.exc_info) { %>
<span class="origin">from <strong><%= d.origin %></strong></span>
<% } %>
<div class="job_id"><%= d.id %></div>
<% if (d.exc_info) { %>
<span class="end_date">Failed <%= d.ended_at %></span>
<pre class="exc_info"><%= $('<div/>').text(d.exc_info).html() %></pre>
<% } %>
</td>
<td><span class="creation_date"><%= d.created_at %></span></td>
<td class="actions narrow">
<% if (d.exc_info) { %>
<a href="#" data-role="requeue-job-btn" class="btn btn-small"><i class="icon-retweet"></i>
Requeue</a>
<% } %>
<a href="#" data-role="cancel-job-btn" class="btn btn-small"><i class="icon-remove"></i> Cancel</a>
</td>
</tr>
</script>

<script name="no-jobs-row" type="text/template">
<tr>
<td colspan="3">No jobs.</td>
</tr>
</script>

<div id="page-selection" class="pagination pagination-centered">
<ul>
</ul>
</div>

<script name="first-page-link" type="text/template">
<li><a href="<%= url %>">&laquo;</a></li>
</script>

<script name="no-previous-page-link" type="text/template">
<li class="disabled"><a href="#">&lsaquo;</a></li>
</script>

<script name="previous-page-link" type="text/template">
<li><a href="<%= url %>">&lsaquo;</a></li>
</script>
{% include "rq_dashboard/queues.html" %}
{% include "rq_dashboard/workers.html" %}
</div>

<script name="page-link" type="text/template">
<li><a href="<%= url %>"><%= number %></a></li>
</script>
{% import 'rq_dashboard/jobs_table.html' as job_table %}

<script name="next-page-link" type="text/template">
<li><a href="<%= url %>">&rsaquo;</a></li>
</script>
{{ job_table.render_html(queue.name, 'pending', newest_top) }}

<script name="no-next-page-link" type="text/template">
<li class="disabled"><a href="#">&rsaquo;</a></li>
</script>
{% if queue.name != 'failed' %}
{{ job_table.render_html(queue.name, 'running', newest_top) }}
{% endif %}

<script name="last-page-link" type="text/template">
<li><a href="<%= url %>">&raquo;</a></li>
</script>
{% if queue.name != 'failed' %}
{{ job_table.render_html(queue.name, 'finished', newest_top) }}
{% endif %}

</div>
</div>
</div>
<div class="row">
<div class="span12">
<div class="section">
Expand All @@ -202,7 +32,6 @@ <h1>Jobs on <strong{% if queue.name == 'failed' %} class="failed"{% endif %}>{{
</div>
</div>


{% endblock %}


Expand Down