solid_queue_monitor 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/assets/javascripts/solid_queue_monitor/application.js +56 -0
- data/app/controllers/solid_queue_monitor/ready_jobs_controller.rb +26 -0
- data/app/services/solid_queue_monitor/discard_ready_job_service.rb +72 -0
- data/app/views/solid_queue_monitor/failed_jobs/index.html.erb +17 -16
- data/app/views/solid_queue_monitor/ready_jobs/_row.html.erb +12 -0
- data/app/views/solid_queue_monitor/ready_jobs/index.html.erb +13 -1
- data/config/routes.rb +3 -0
- data/lib/solid_queue_monitor/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af61e7ad359f2bb630f2cd42c14af5488f0f7fa28700a361a5bc4735acf7279a
|
|
4
|
+
data.tar.gz: 936cd1349176dc4b7873ed3f807a9303af09459840f62fe521fa7352b5a7d29a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e5e6ec83387a83f9b4cdedfa9423ad6a15e375a0afc2ca55526867baf274abc820a5857f6c007ce734b2dea1f6b4d5a49b2de1ed8ef956e7a012959507acb60f
|
|
7
|
+
data.tar.gz: 6541b3efaab1498a7453f83013740bd529a5470f009e9b8bff786ce27c16056553489b0fa871ef3f14379d0cd9f93223f296f98f4bb08dc82a97c4afde9c2413
|
data/README.md
CHANGED
|
@@ -28,7 +28,7 @@ A lightweight, zero-dependency web interface for monitoring Solid Queue backgrou
|
|
|
28
28
|
- Complete error details with backtrace for failed jobs
|
|
29
29
|
- Job arguments displayed in formatted JSON
|
|
30
30
|
- **Queue Details Page**: Detailed view for individual queues with job counts and filtering
|
|
31
|
-
- **Ready Jobs**: View jobs that are ready to be executed
|
|
31
|
+
- **Ready Jobs**: View jobs that are ready to be executed, with the ability to discard them (e.g. jobs stranded on a queue no worker polls)
|
|
32
32
|
- **In Progress Jobs**: Monitor jobs currently being processed by workers
|
|
33
33
|
- **Scheduled Jobs**: See upcoming jobs scheduled for future execution with ability to execute immediately or reject permanently
|
|
34
34
|
- **Recurring Jobs**: Manage periodic jobs that run on a schedule
|
|
@@ -38,7 +38,7 @@ A lightweight, zero-dependency web interface for monitoring Solid Queue backgrou
|
|
|
38
38
|
- **Global Search**: Search across all job types by class name, queue, arguments, job ID, and error messages
|
|
39
39
|
- **Sortable Columns**: Click column headers to sort job tables by any column with ascending/descending toggle
|
|
40
40
|
- **Advanced Job Filtering**: Filter jobs by class name, queue, status, and job arguments
|
|
41
|
-
- **Quick Actions**: Retry or discard failed jobs, execute or reject scheduled jobs directly from any view
|
|
41
|
+
- **Quick Actions**: Retry or discard failed jobs, discard ready jobs, execute or reject scheduled jobs directly from any view
|
|
42
42
|
- **Performance Optimized**: Designed for high-volume applications with smart pagination
|
|
43
43
|
- **Auto-refresh**: Real-time monitoring with configurable auto-refresh interval and toggle
|
|
44
44
|
- **Optional Authentication**: Secure your dashboard with HTTP Basic Authentication
|
|
@@ -236,7 +236,7 @@ After installation, visit `/solid_queue` in your browser to access the dashboard
|
|
|
236
236
|
The dashboard provides several views:
|
|
237
237
|
|
|
238
238
|
- **Overview**: Shows statistics, recent jobs, and job activity chart
|
|
239
|
-
- **Ready Jobs**: Jobs that are ready to be executed
|
|
239
|
+
- **Ready Jobs**: Jobs that are ready to be executed, with a discard action
|
|
240
240
|
- **Scheduled Jobs**: Jobs scheduled for future execution with execute and reject actions
|
|
241
241
|
- **Recurring Jobs**: Jobs that run on a recurring schedule, with a Run now action that enqueues one task immediately without changing its schedule
|
|
242
242
|
- **Failed Jobs**: Jobs that have failed with error details and retry/discard actions
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
initChartTooltip();
|
|
15
15
|
initScheduledBulkActions();
|
|
16
16
|
initFailedJobsBulkActions();
|
|
17
|
+
initReadyJobsBulkActions();
|
|
17
18
|
initJobDetailsBehaviors();
|
|
18
19
|
initGlobalBehaviors();
|
|
19
20
|
});
|
|
@@ -358,6 +359,61 @@
|
|
|
358
359
|
updateButtonState();
|
|
359
360
|
}
|
|
360
361
|
|
|
362
|
+
function initReadyJobsBulkActions() {
|
|
363
|
+
var form = document.getElementById('ready-jobs-form');
|
|
364
|
+
if (!form) return;
|
|
365
|
+
|
|
366
|
+
var selectAll = document.getElementById('ready-jobs-select-all');
|
|
367
|
+
var discardButton = document.getElementById('discard-ready-selected-top');
|
|
368
|
+
|
|
369
|
+
function checkboxes() {
|
|
370
|
+
return Array.prototype.slice.call(document.querySelectorAll('.ready-job-checkbox'));
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function checkedBoxes() {
|
|
374
|
+
return checkboxes().filter(function (checkbox) { return checkbox.checked; });
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function updateButtonState() {
|
|
378
|
+
if (discardButton) discardButton.disabled = checkedBoxes().length === 0;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (selectAll) {
|
|
382
|
+
selectAll.addEventListener('change', function () {
|
|
383
|
+
checkboxes().forEach(function (checkbox) { checkbox.checked = selectAll.checked; });
|
|
384
|
+
updateButtonState();
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
checkboxes().forEach(function (checkbox) {
|
|
389
|
+
checkbox.addEventListener('change', function () {
|
|
390
|
+
if (selectAll) selectAll.checked = checkedBoxes().length === checkboxes().length;
|
|
391
|
+
updateButtonState();
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
if (discardButton) {
|
|
396
|
+
discardButton.addEventListener('click', function () {
|
|
397
|
+
var ids = checkedBoxes().map(function (checkbox) { return checkbox.value; });
|
|
398
|
+
if (ids.length === 0) return;
|
|
399
|
+
if (!window.confirm('Are you sure you want to discard the selected jobs? They will not run. This action cannot be undone.')) return;
|
|
400
|
+
|
|
401
|
+
Array.prototype.slice.call(form.querySelectorAll('input[type="hidden"][name="job_ids[]"]')).forEach(function (input) { input.remove(); });
|
|
402
|
+
form.action = discardButton.dataset.actionUrl;
|
|
403
|
+
ids.forEach(function (id) {
|
|
404
|
+
var input = document.createElement('input');
|
|
405
|
+
input.type = 'hidden';
|
|
406
|
+
input.name = 'job_ids[]';
|
|
407
|
+
input.value = id;
|
|
408
|
+
form.appendChild(input);
|
|
409
|
+
});
|
|
410
|
+
form.submit();
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
updateButtonState();
|
|
415
|
+
}
|
|
416
|
+
|
|
361
417
|
function initJobDetailsBehaviors() {
|
|
362
418
|
document.addEventListener('click', function (e) {
|
|
363
419
|
var el = e.target.closest('[data-action]');
|
|
@@ -12,5 +12,31 @@ module SolidQueueMonitor
|
|
|
12
12
|
@sort = sort_params
|
|
13
13
|
@action_path = ready_jobs_path
|
|
14
14
|
end
|
|
15
|
+
|
|
16
|
+
def discard
|
|
17
|
+
id = params[:id]
|
|
18
|
+
|
|
19
|
+
if SolidQueueMonitor::DiscardReadyJobService.new.call(id)
|
|
20
|
+
set_flash_message("Job #{id} has been discarded.", 'success')
|
|
21
|
+
else
|
|
22
|
+
set_flash_message("Failed to discard job #{id}: it is no longer ready.", 'error')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
redirect_to ready_jobs_path
|
|
26
|
+
rescue StandardError => e
|
|
27
|
+
set_flash_message("Failed to discard job #{id}: #{e.message}", 'error')
|
|
28
|
+
redirect_to ready_jobs_path
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def discard_all
|
|
32
|
+
result = SolidQueueMonitor::DiscardReadyJobService.new.discard_many(params[:job_ids])
|
|
33
|
+
|
|
34
|
+
if result[:success]
|
|
35
|
+
set_flash_message(result[:message], 'success')
|
|
36
|
+
else
|
|
37
|
+
set_flash_message(result[:message], 'error')
|
|
38
|
+
end
|
|
39
|
+
redirect_to ready_jobs_path
|
|
40
|
+
end
|
|
15
41
|
end
|
|
16
42
|
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SolidQueueMonitor
|
|
4
|
+
class DiscardReadyJobService
|
|
5
|
+
def call(id)
|
|
6
|
+
discard_job(id)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def discard_many(ids)
|
|
10
|
+
return { success: false, message: 'No jobs selected' } if ids.blank?
|
|
11
|
+
|
|
12
|
+
success_count = 0
|
|
13
|
+
failed_count = 0
|
|
14
|
+
|
|
15
|
+
Array(ids).each do |id|
|
|
16
|
+
if discard_job(id)
|
|
17
|
+
success_count += 1
|
|
18
|
+
else
|
|
19
|
+
failed_count += 1
|
|
20
|
+
end
|
|
21
|
+
rescue StandardError
|
|
22
|
+
failed_count += 1
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if success_count.positive? && failed_count.zero?
|
|
26
|
+
{ success: true, message: 'All selected jobs have been discarded' }
|
|
27
|
+
elsif success_count.positive? && failed_count.positive?
|
|
28
|
+
{ success: true, message: "#{success_count} jobs discarded, #{failed_count} failed" }
|
|
29
|
+
else
|
|
30
|
+
{ success: false, message: 'Failed to discard jobs' }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
# Deleting the ready execution is what claims the job, as it is for a
|
|
37
|
+
# worker: whoever deletes the row first wins. This holds on SQLite too,
|
|
38
|
+
# where the row lock is a no-op, so a job a worker already claimed counts
|
|
39
|
+
# as failed instead of being marked finished while it runs.
|
|
40
|
+
def discard_job(id)
|
|
41
|
+
SolidQueue::ReadyExecution.transaction do
|
|
42
|
+
execution = SolidQueue::ReadyExecution.lock.find_by(id: id)
|
|
43
|
+
next false unless execution
|
|
44
|
+
next false unless SolidQueue::ReadyExecution.where(id: execution.id).delete_all == 1
|
|
45
|
+
|
|
46
|
+
# An execution whose job row is gone is just removed.
|
|
47
|
+
job = SolidQueue::Job.find_by(id: execution.job_id)
|
|
48
|
+
next true unless job
|
|
49
|
+
|
|
50
|
+
release_concurrency_slot(job)
|
|
51
|
+
job.update!(finished_at: Time.current)
|
|
52
|
+
true
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# A ready job holds its concurrency slot; give it back so blocked jobs
|
|
57
|
+
# with the same key can run. `try` because Solid Queue versions without
|
|
58
|
+
# concurrency controls lack these methods.
|
|
59
|
+
def release_concurrency_slot(job)
|
|
60
|
+
return unless job.try(:concurrency_limited?)
|
|
61
|
+
|
|
62
|
+
if job.class_name.safe_constantize
|
|
63
|
+
job.unblock_next_blocked_job
|
|
64
|
+
else
|
|
65
|
+
# The limit comes from the job class, so without it the next blocked
|
|
66
|
+
# job can't be released here. Free the slot by key, as Solid Queue's
|
|
67
|
+
# own bulk discard does; its dispatcher then unblocks waiting jobs.
|
|
68
|
+
SolidQueue::Job.release_all_concurrency_locks([job])
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -16,24 +16,25 @@
|
|
|
16
16
|
|
|
17
17
|
<form method="post" id="failed-jobs-form">
|
|
18
18
|
<%= csrf_token_field_if_enabled %>
|
|
19
|
-
<% columns = [
|
|
20
|
-
{ sort_key: nil, label: tag.input(type: 'checkbox', id: 'select-all', class: 'select-all-checkbox') },
|
|
21
|
-
{ sort_key: :class_name, label: 'Job' },
|
|
22
|
-
{ sort_key: :queue_name, label: 'Queue' },
|
|
23
|
-
{ sort_key: nil, label: 'Error' },
|
|
24
|
-
{ sort_key: nil, label: 'Arguments' },
|
|
25
|
-
{ sort_key: :created_at, label: 'Failed At' },
|
|
26
|
-
{ sort_key: nil, label: 'Actions' }
|
|
27
|
-
] %>
|
|
28
|
-
|
|
29
|
-
<%= render 'solid_queue_monitor/shared/jobs_table',
|
|
30
|
-
jobs: @failed_jobs[:records],
|
|
31
|
-
columns: columns,
|
|
32
|
-
sort: @sort,
|
|
33
|
-
filters: @filters,
|
|
34
|
-
row_partial: 'solid_queue_monitor/failed_jobs/row' %>
|
|
35
19
|
</form>
|
|
36
20
|
|
|
21
|
+
<% columns = [
|
|
22
|
+
{ sort_key: nil, label: tag.input(type: 'checkbox', id: 'select-all', class: 'select-all-checkbox') },
|
|
23
|
+
{ sort_key: :class_name, label: 'Job' },
|
|
24
|
+
{ sort_key: :queue_name, label: 'Queue' },
|
|
25
|
+
{ sort_key: nil, label: 'Error' },
|
|
26
|
+
{ sort_key: nil, label: 'Arguments' },
|
|
27
|
+
{ sort_key: :created_at, label: 'Failed At' },
|
|
28
|
+
{ sort_key: nil, label: 'Actions' }
|
|
29
|
+
] %>
|
|
30
|
+
|
|
31
|
+
<%= render 'solid_queue_monitor/shared/jobs_table',
|
|
32
|
+
jobs: @failed_jobs[:records],
|
|
33
|
+
columns: columns,
|
|
34
|
+
sort: @sort,
|
|
35
|
+
filters: @filters,
|
|
36
|
+
row_partial: 'solid_queue_monitor/failed_jobs/row' %>
|
|
37
|
+
|
|
37
38
|
<%= render 'solid_queue_monitor/shared/pagination',
|
|
38
39
|
current_page: @failed_jobs[:current_page],
|
|
39
40
|
total_pages: @failed_jobs[:total_pages] %>
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
<tr>
|
|
2
|
+
<td><input type="checkbox" class="ready-job-checkbox" value="<%= job.id %>"></td>
|
|
2
3
|
<td><%= link_to job.job.class_name, job_path(job.job), class: 'job-class-link' %></td>
|
|
3
4
|
<td><%= queue_link(job.queue_name) %></td>
|
|
4
5
|
<td><%= job.priority %></td>
|
|
5
6
|
<td><%= format_arguments(job.job.arguments) %></td>
|
|
6
7
|
<td><%= format_datetime(job.created_at) %></td>
|
|
8
|
+
<td class="actions-cell">
|
|
9
|
+
<div class="job-actions">
|
|
10
|
+
<form method="post"
|
|
11
|
+
action="<%= discard_ready_job_path(id: job.id) %>"
|
|
12
|
+
class="inline-form"
|
|
13
|
+
data-confirm="Are you sure you want to discard this job? It will not run.">
|
|
14
|
+
<%= csrf_token_field_if_enabled %>
|
|
15
|
+
<button type="submit" class="action-button discard-button">Discard</button>
|
|
16
|
+
</form>
|
|
17
|
+
</div>
|
|
18
|
+
</td>
|
|
7
19
|
</tr>
|
|
@@ -5,12 +5,24 @@
|
|
|
5
5
|
filters: @filters,
|
|
6
6
|
show_status: false %>
|
|
7
7
|
|
|
8
|
+
<div class="bulk-actions-bar">
|
|
9
|
+
<button type="button" class="action-button discard-button" id="discard-ready-selected-top" data-action-url="<%= discard_ready_jobs_path %>" disabled>
|
|
10
|
+
Discard Selected
|
|
11
|
+
</button>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<form method="post" id="ready-jobs-form">
|
|
15
|
+
<%= csrf_token_field_if_enabled %>
|
|
16
|
+
</form>
|
|
17
|
+
|
|
8
18
|
<% columns = [
|
|
19
|
+
{ sort_key: nil, label: tag.input(type: 'checkbox', id: 'ready-jobs-select-all') },
|
|
9
20
|
{ sort_key: :class_name, label: 'Job' },
|
|
10
21
|
{ sort_key: :queue_name, label: 'Queue' },
|
|
11
22
|
{ sort_key: :priority, label: 'Priority' },
|
|
12
23
|
{ sort_key: nil, label: 'Arguments' },
|
|
13
|
-
{ sort_key: :created_at, label: 'Created At' }
|
|
24
|
+
{ sort_key: :created_at, label: 'Created At' },
|
|
25
|
+
{ sort_key: nil, label: 'Actions' }
|
|
14
26
|
] %>
|
|
15
27
|
|
|
16
28
|
<%= render 'solid_queue_monitor/shared/jobs_table',
|
data/config/routes.rb
CHANGED
|
@@ -21,6 +21,9 @@ SolidQueueMonitor::Engine.routes.draw do
|
|
|
21
21
|
resources :workers, only: [:index]
|
|
22
22
|
resources :jobs, only: [:show]
|
|
23
23
|
|
|
24
|
+
post 'discard_ready_job/:id', to: 'ready_jobs#discard', as: :discard_ready_job
|
|
25
|
+
post 'discard_ready_jobs', to: 'ready_jobs#discard_all', as: :discard_ready_jobs
|
|
26
|
+
|
|
24
27
|
post 'execute_jobs', to: 'scheduled_jobs#create', as: :execute_jobs
|
|
25
28
|
post 'execute_scheduled_job/:id', to: 'scheduled_jobs#execute', as: :execute_scheduled_job
|
|
26
29
|
post 'reject_jobs', to: 'scheduled_jobs#reject_all', as: :reject_jobs
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solid_queue_monitor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vishal Sadriya
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -74,6 +74,7 @@ files:
|
|
|
74
74
|
- app/services/solid_queue_monitor/asset_cache.rb
|
|
75
75
|
- app/services/solid_queue_monitor/authentication_service.rb
|
|
76
76
|
- app/services/solid_queue_monitor/chart_data_service.rb
|
|
77
|
+
- app/services/solid_queue_monitor/discard_ready_job_service.rb
|
|
77
78
|
- app/services/solid_queue_monitor/enqueue_recurring_task_service.rb
|
|
78
79
|
- app/services/solid_queue_monitor/execute_job_service.rb
|
|
79
80
|
- app/services/solid_queue_monitor/failed_job_service.rb
|