mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 21:18:16 -06:00
14729 no queue param on task
This commit is contained in:
parent
3e18fa997b
commit
031cd04413
@ -53,7 +53,7 @@ class BackgroundTaskTable(BaseTable):
|
||||
def render_id(self, value, record):
|
||||
return mark_safe('<a href=' + reverse(
|
||||
"core:background_task",
|
||||
args=[self.queue_index, value]) + '>' + value + '</a>'
|
||||
args=[value]) + '>' + value + '</a>'
|
||||
)
|
||||
|
||||
def render_status(self, value, record):
|
||||
|
@ -28,7 +28,7 @@ urlpatterns = (
|
||||
# Background Tasks
|
||||
path('background-queues/', views.BackgroundQueueListView.as_view(), name='background_queue_list'),
|
||||
path('background-queues/<int:queue_index>/', views.BackgroundTaskListView.as_view(), name='background_task_list'),
|
||||
path('background-tasks/<int:queue_index>/<str:job_id>/', views.BackgroundTaskDetailView.as_view(), name='background_task'),
|
||||
path('background-tasks/<str:job_id>/', views.BackgroundTaskDetailView.as_view(), name='background_task'),
|
||||
|
||||
# Config revisions
|
||||
path('config-revisions/', views.ConfigRevisionListView.as_view(), name='configrevision_list'),
|
||||
|
@ -5,7 +5,8 @@ from django.contrib.auth.mixins import UserPassesTestMixin
|
||||
from django.core.cache import cache
|
||||
from django.http import HttpResponseForbidden, Http404
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_rq.queues import get_queue_by_index
|
||||
from django_rq.queues import get_queue_by_index, get_redis_connection
|
||||
from django_rq.settings import QUEUES_MAP, QUEUES_LIST
|
||||
from django_rq.utils import get_scheduler_statistics, get_statistics
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.views.generic import View
|
||||
@ -285,14 +286,17 @@ class BackgroundTaskDetailView(UserPassesTestMixin, View):
|
||||
def test_func(self):
|
||||
return self.request.user.is_staff
|
||||
|
||||
def get(self, request, queue_index, job_id):
|
||||
queue = get_queue_by_index(queue_index)
|
||||
|
||||
def get(self, request, job_id):
|
||||
# all the RQ queues should use the same connection
|
||||
config = QUEUES_LIST[0]
|
||||
try:
|
||||
job = RQ_Job.fetch(job_id, connection=queue.connection, serializer=queue.serializer)
|
||||
job = RQ_Job.fetch(job_id, connection=get_redis_connection(config['connection_config']),)
|
||||
except NoSuchJobError:
|
||||
raise Http404(_("Job {job_id} not found").format(job_id=job_id))
|
||||
|
||||
queue_index = QUEUES_MAP[job.origin]
|
||||
queue = get_queue_by_index(queue_index)
|
||||
|
||||
try:
|
||||
job.func_name
|
||||
data_is_valid = True
|
||||
|
Loading…
Reference in New Issue
Block a user