-
-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RQScheduler django admin integration (#587)
* wip * Allow all job ids that do not contain forward slash * Tests * WIP * Admin link, try to support multiple redis connections * Bring it all together * Scheduler name * Pull scheduler stats into the main queues view * Undo unneeded changes * Undo more unneeded changes * cleanup * cleanup * Add a test for non-cron scheduled jobs and fix the bug that was somewhat present * Missing imports * Install rq-scheduler * Pull get_scheduler_statistics out
- Loading branch information
Showing
9 changed files
with
284 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
{% extends "admin/base_site.html" %} | ||
|
||
{% load static jquery_path django_rq %} | ||
|
||
{% block title %}Scheduler Jobs in {{ scheduler.name }} {{ block.super }}{% endblock %} | ||
|
||
{% block extrastyle %} | ||
{{ block.super }} | ||
<link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}"> | ||
{% endblock %} | ||
|
||
{% block extrahead %} | ||
{{ block.super }} | ||
<script type="text/javascript" src="{% get_jquery_path as jquery_path %}{% static jquery_path %}"></script> | ||
<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script> | ||
<script type="text/javascript" src="{% static "admin/js/actions.js" %}"></script> | ||
<script type="text/javascript"> | ||
(function($) { | ||
$(document).ready(function($) { | ||
$("tr input.action-select").actions(); | ||
}); | ||
})(django.jQuery); | ||
</script> | ||
{% endblock %} | ||
|
||
|
||
{% block breadcrumbs %} | ||
<div class="breadcrumbs"> | ||
<a href="{% url 'admin:index' %}">Home</a> › | ||
<a href="{% url 'rq_home' %}">Django RQ</a> › | ||
</div> | ||
{% endblock %} | ||
|
||
{% block content_title %}<h1>Scheduler Managed Jobs</h1>{% endblock %} | ||
|
||
{% block content %} | ||
|
||
<div id="content-main"> | ||
<ul class="object-tools"> | ||
</ul> | ||
<div class="module" id="changelist"> | ||
<form id="changelist-form" action="" method="post"> | ||
{% csrf_token %} | ||
<div class="actions"> | ||
<label>Actions: | ||
<select name="action"> | ||
<option value="" selected="selected">---------</option> | ||
<option value="delete">Delete</option> | ||
{% if job_status == 'Failed' %} | ||
<option value="requeue">Requeue</option> | ||
{% endif %} | ||
</select> | ||
</label> | ||
<button type="submit" class="button" title="Execute selected action" name="index" value="0">Go</button> | ||
</div> | ||
<div class="results"> | ||
<table id="result_list"> | ||
<thead> | ||
<tr> | ||
<th scope="col" class="action-checkbox-column"> | ||
<div class="text"> | ||
<span><input type="checkbox" id="action-toggle" style="display: inline-block;"></span> | ||
</div> | ||
<div class="clear"></div> | ||
</th> | ||
<th><div class = 'text'><span>ID</span></div></th> | ||
<th><div class = 'text'><span>Schedule</span></div></th> | ||
<th><div class = 'text'><span>Next Run</span></div></th> | ||
<th><div class = 'text'><span>Last Ended</span></div></th> | ||
<th><div class = 'text'><span>Last Status</span></div></th> | ||
<th><div class = 'text'><span>Callable</span></div></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for job in jobs %} | ||
<tr class = "{% cycle 'row1' 'row2' %}"> | ||
<td class="action-checkbox"> | ||
<input class="action-select" name="_selected_action" type="checkbox" value="{{ job.id }}"> | ||
</td> | ||
<td> | ||
<a href = "{% url 'rq_job_detail' job.queue_index job.id %}"> | ||
{{ job.id }} | ||
</a> | ||
</td> | ||
<td>{{ job.schedule }}</td> | ||
<td> | ||
{% if job.next_run %} | ||
{{ job.next_run|to_localtime|date:"Y-m-d, H:i:s" }} | ||
{% endif %} | ||
</td> | ||
<td> | ||
{% if job.ended_at %} | ||
{{ job.ended_at|to_localtime|date:"Y-m-d, H:i:s" }} | ||
{% endif %} | ||
</td> | ||
<td>{{ job.get_status }}</td> | ||
<td>{{ job|show_func_name }}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
<p class="paginator"> | ||
{% for p in page_range %} | ||
{% if p == page %} | ||
<span class="this-page">{{ p }}</span> | ||
{% elif forloop.last %} | ||
<a href="?page={{ p }}" class="end">{{ p }}</a> | ||
{% else %} | ||
<a href="?page={{ p }}">{{ p }}</a> | ||
{% endif %} | ||
{% endfor %} | ||
{{ num_jobs }} jobs | ||
</p> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.