From b6e3ad6421de7029a11db6cfbf99de86787bcc47 Mon Sep 17 00:00:00 2001 From: Andrey Nehaychik Date: Mon, 4 Dec 2023 22:57:06 +0100 Subject: [PATCH 1/2] Support Scheduled and Cancelled registries --- rq_dashboard/templates/rq_dashboard/jobs.html | 4 ++- .../templates/rq_dashboard/queues.html | 4 +++ rq_dashboard/version.py | 2 +- rq_dashboard/web.py | 33 +++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/rq_dashboard/templates/rq_dashboard/jobs.html b/rq_dashboard/templates/rq_dashboard/jobs.html index 824bbe32..2711597f 100644 --- a/rq_dashboard/templates/rq_dashboard/jobs.html +++ b/rq_dashboard/templates/rq_dashboard/jobs.html @@ -19,11 +19,13 @@ + +

diff --git a/rq_dashboard/templates/rq_dashboard/queues.html b/rq_dashboard/templates/rq_dashboard/queues.html index fd502098..5af33f1b 100644 --- a/rq_dashboard/templates/rq_dashboard/queues.html +++ b/rq_dashboard/templates/rq_dashboard/queues.html @@ -14,9 +14,11 @@

Queues

Queue Queued jobs Deferred jobs + Scheduled jobs Started jobs Finished jobs Failed jobs + Canceled jobs @@ -32,9 +34,11 @@

Queues

<%= d.name %> <%= d.count %> <%= d.deferred_job_registry_count %> + <%= d.scheduled_job_registry_count %> <%= d.started_job_registry_count %> <%= d.finished_job_registry_count %> <%= d.failed_job_registry_count %> + <%= d.canceled_job_registry_count %> diff --git a/rq_dashboard/version.py b/rq_dashboard/version.py index dfbedfa9..171def37 100644 --- a/rq_dashboard/version.py +++ b/rq_dashboard/version.py @@ -1 +1 @@ -VERSION = "0.6.7" +VERSION = "0.6.7.1" diff --git a/rq_dashboard/web.py b/rq_dashboard/web.py index 2d37fafe..05a2daa5 100644 --- a/rq_dashboard/web.py +++ b/rq_dashboard/web.py @@ -47,6 +47,9 @@ FailedJobRegistry, FinishedJobRegistry, StartedJobRegistry, + ScheduledJobRegistry, + CanceledJobRegistry, + ) from six import string_types @@ -154,6 +157,24 @@ def serialize_queues(instance_number, queues): per_page="8", page="1", ), + canceled_job_registry_count=CanceledJobRegistry(q.name).count, + canceled_url=url_for( + ".jobs_overview", + instance_number=instance_number, + queue_name=q.name, + registry_name="canceled", + per_page="8", + page="1", + ), + scheduled_job_registry_count=ScheduledJobRegistry(q.name).count, + scheduled_url=url_for( + ".jobs_overview", + instance_number=instance_number, + queue_name=q.name, + registry_name="scheduled", + per_page="8", + page="1", + ), ) for q in queues ] @@ -226,6 +247,10 @@ def get_queue_registry_jobs_count(queue_name, registry_name, offset, per_page): current_queue = StartedJobRegistry(queue_name) elif registry_name == "finished": current_queue = FinishedJobRegistry(queue_name) + elif registry_name == "scheduled": + current_queue = ScheduledJobRegistry(queue_name) + elif registry_name == "canceled": + current_queue = CanceledJobRegistry(queue_name) else: current_queue = queue total_items = current_queue.count @@ -404,6 +429,14 @@ def empty_queue(queue_name, registry_name): ids = FinishedJobRegistry(queue_name).get_job_ids() for id in ids: delete_job_view(id) + elif registry_name == "canceled": + ids = CanceledJobRegistry(queue_name).get_job_ids() + for id in ids: + delete_job_view(id) + elif registry_name == "scheduled": + ids = ScheduledJobRegistry(queue_name).get_job_ids() + for id in ids: + delete_job_view(id) return dict(status="OK") From 51e2816641def759ae3ed0e72ea2d20185ebf0f1 Mon Sep 17 00:00:00 2001 From: Andrey Nehaychik Date: Wed, 14 Feb 2024 06:08:31 +0100 Subject: [PATCH 2/2] Update version after syncing --- rq_dashboard/version.py | 2 +- version.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rq_dashboard/version.py b/rq_dashboard/version.py index 171def37..369c38e6 100644 --- a/rq_dashboard/version.py +++ b/rq_dashboard/version.py @@ -1 +1 @@ -VERSION = "0.6.7.1" +VERSION = "0.6.7.2" diff --git a/version.json b/version.json index 11708e0b..b824389d 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{ "version": "0.6.7" } +{ "version": "0.6.7.2" }