solid_queue_monitor 0.3.1 → 0.3.2
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/LICENSE +21 -0
- data/README.md +6 -6
- data/app/controllers/solid_queue_monitor/scheduled_jobs_controller.rb +11 -0
- data/app/presenters/solid_queue_monitor/scheduled_jobs_presenter.rb +38 -9
- data/app/services/solid_queue_monitor/reject_job_service.rb +49 -0
- data/config/routes.rb +1 -0
- data/lib/solid_queue_monitor/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76559272501afef3ca73a5f8739a0d6bea2c7c3dc5fc4a3153ed9890f5a8f0b5
|
4
|
+
data.tar.gz: efcfd9438981bc2f35a8925c6d2b08120ec490441e8f66959202c5d78dff7990
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6d8a0d27f8770f9c7ebf838e2f7e78ac72afbdf900ff5718c98861bfb25ab151250a5f36be58edcdcaa029f82d68118e0f5aa102d12c6054289e428f83069d7
|
7
|
+
data.tar.gz: 0750abe0b179438a53c8519fad9219247850de0fb661f57dd9800eb120446c4f5cea3d128ffd8b310842c0f5334c22c6f2c3db800ff46a2ffa66564b1071893d
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Vishal Sadriya
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -18,12 +18,12 @@ A lightweight, zero-dependency web interface for monitoring Solid Queue backgrou
|
|
18
18
|
- **Dashboard Overview**: Get a quick snapshot of your queue's health with statistics on all job types
|
19
19
|
- **Ready Jobs**: View jobs that are ready to be executed
|
20
20
|
- **In Progress Jobs**: Monitor jobs currently being processed by workers
|
21
|
-
- **Scheduled Jobs**: See upcoming jobs scheduled for future execution
|
21
|
+
- **Scheduled Jobs**: See upcoming jobs scheduled for future execution with ability to execute immediately or reject permanently
|
22
22
|
- **Recurring Jobs**: Manage periodic jobs that run on a schedule
|
23
23
|
- **Failed Jobs**: Track and debug failed jobs, with the ability to retry or discard them
|
24
24
|
- **Queue Management**: View and filter jobs by queue
|
25
25
|
- **Advanced Job Filtering**: Filter jobs by class name, queue, status, and job arguments
|
26
|
-
- **Quick Actions**: Retry or discard failed jobs directly from any view
|
26
|
+
- **Quick Actions**: Retry or discard failed jobs, execute or reject scheduled jobs directly from any view
|
27
27
|
- **Performance Optimized**: Designed for high-volume applications with smart pagination
|
28
28
|
- **Optional Authentication**: Secure your dashboard with HTTP Basic Authentication
|
29
29
|
- **Responsive Design**: Works on desktop and mobile devices
|
@@ -44,7 +44,7 @@ A lightweight, zero-dependency web interface for monitoring Solid Queue backgrou
|
|
44
44
|
Add this line to your application's Gemfile:
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
gem 'solid_queue_monitor', '~> 0.3.
|
47
|
+
gem 'solid_queue_monitor', '~> 0.3.2'
|
48
48
|
```
|
49
49
|
|
50
50
|
Then execute:
|
@@ -103,9 +103,9 @@ The dashboard provides several views:
|
|
103
103
|
|
104
104
|
- **Overview**: Shows statistics and recent jobs
|
105
105
|
- **Ready Jobs**: Jobs that are ready to be executed
|
106
|
-
- **Scheduled Jobs**: Jobs scheduled for future execution
|
106
|
+
- **Scheduled Jobs**: Jobs scheduled for future execution with execute and reject actions
|
107
107
|
- **Recurring Jobs**: Jobs that run on a recurring schedule
|
108
|
-
- **Failed Jobs**: Jobs that have failed with error details
|
108
|
+
- **Failed Jobs**: Jobs that have failed with error details and retry/discard actions
|
109
109
|
- **Queues**: Distribution of jobs across different queues
|
110
110
|
|
111
111
|
### API-only Applications
|
@@ -127,7 +127,7 @@ This makes it easy to find specific jobs when debugging issues in your applicati
|
|
127
127
|
|
128
128
|
- **Production Monitoring**: Keep an eye on your background job processing in production environments
|
129
129
|
- **Debugging**: Quickly identify and troubleshoot failed jobs
|
130
|
-
- **Job Management**: Execute scheduled jobs on demand
|
130
|
+
- **Job Management**: Execute scheduled jobs on demand or reject unwanted jobs permanently
|
131
131
|
- **Performance Analysis**: Track job distribution and identify bottlenecks
|
132
132
|
- **DevOps Integration**: Easily integrate with your monitoring stack
|
133
133
|
|
@@ -21,5 +21,16 @@ module SolidQueueMonitor
|
|
21
21
|
end
|
22
22
|
redirect_to scheduled_jobs_path
|
23
23
|
end
|
24
|
+
|
25
|
+
def reject_all
|
26
|
+
result = SolidQueueMonitor::RejectJobService.new.reject_many(params[:job_ids])
|
27
|
+
|
28
|
+
if result[:success]
|
29
|
+
set_flash_message(result[:message], 'success')
|
30
|
+
else
|
31
|
+
set_flash_message(result[:message], 'error')
|
32
|
+
end
|
33
|
+
redirect_to scheduled_jobs_path
|
34
|
+
end
|
24
35
|
end
|
25
36
|
end
|
@@ -46,13 +46,14 @@ module SolidQueueMonitor
|
|
46
46
|
|
47
47
|
<div class="bulk-actions-bar">
|
48
48
|
<button type="button" class="action-button execute-button" id="execute-selected-top" disabled>Execute Selected</button>
|
49
|
+
<button type="button" class="action-button discard-button" id="reject-selected-top" disabled>Reject Selected</button>
|
49
50
|
</div>
|
50
51
|
HTML
|
51
52
|
end
|
52
53
|
|
53
54
|
def generate_table_with_actions
|
54
55
|
<<-HTML
|
55
|
-
<form id="scheduled-jobs-form"
|
56
|
+
<form id="scheduled-jobs-form" method="POST">
|
56
57
|
#{generate_table}
|
57
58
|
</form>
|
58
59
|
<script>
|
@@ -60,17 +61,18 @@ module SolidQueueMonitor
|
|
60
61
|
const selectAllCheckbox = document.querySelector('th input[type="checkbox"]');
|
61
62
|
const jobCheckboxes = document.getElementsByName('job_ids[]');
|
62
63
|
const executeButton = document.getElementById('execute-selected-top');
|
64
|
+
const rejectButton = document.getElementById('reject-selected-top');
|
63
65
|
const form = document.getElementById('scheduled-jobs-form');
|
64
66
|
#{' '}
|
65
67
|
selectAllCheckbox.addEventListener('change', function() {
|
66
68
|
jobCheckboxes.forEach(checkbox => checkbox.checked = this.checked);
|
67
|
-
|
69
|
+
updateButtonStates();
|
68
70
|
});
|
69
71
|
|
70
72
|
jobCheckboxes.forEach(checkbox => {
|
71
73
|
checkbox.addEventListener('change', function() {
|
72
74
|
selectAllCheckbox.checked = Array.from(jobCheckboxes).every(cb => cb.checked);
|
73
|
-
|
75
|
+
updateButtonStates();
|
74
76
|
});
|
75
77
|
});
|
76
78
|
#{' '}
|
@@ -79,6 +81,31 @@ module SolidQueueMonitor
|
|
79
81
|
const selectedIds = Array.from(document.querySelectorAll('input[name="job_ids[]"]:checked')).map(cb => cb.value);
|
80
82
|
if (selectedIds.length === 0) return;
|
81
83
|
#{' '}
|
84
|
+
submitForm('#{execute_jobs_path}', selectedIds);
|
85
|
+
});
|
86
|
+
#{' '}
|
87
|
+
// Add event listener for the reject button
|
88
|
+
rejectButton.addEventListener('click', function() {
|
89
|
+
const selectedIds = Array.from(document.querySelectorAll('input[name="job_ids[]"]:checked')).map(cb => cb.value);
|
90
|
+
if (selectedIds.length === 0) return;
|
91
|
+
#{' '}
|
92
|
+
if (confirm('Are you sure you want to reject the selected jobs? This action cannot be undone.')) {
|
93
|
+
submitForm('#{reject_jobs_path}', selectedIds);
|
94
|
+
}
|
95
|
+
});
|
96
|
+
#{' '}
|
97
|
+
function submitForm(actionUrl, selectedIds) {
|
98
|
+
// Uncheck all checkboxes to prevent duplicate submission
|
99
|
+
document.querySelectorAll('input[name="job_ids[]"]').forEach(checkbox => {
|
100
|
+
checkbox.checked = false;
|
101
|
+
});
|
102
|
+
|
103
|
+
// Clear any existing hidden inputs
|
104
|
+
document.querySelectorAll('input[type="hidden"][name="job_ids[]"]').forEach(input => input.remove());
|
105
|
+
|
106
|
+
// Set form action
|
107
|
+
form.action = actionUrl;
|
108
|
+
|
82
109
|
// Add selected IDs as hidden inputs
|
83
110
|
selectedIds.forEach(id => {
|
84
111
|
const input = document.createElement('input');
|
@@ -87,18 +114,20 @@ module SolidQueueMonitor
|
|
87
114
|
input.value = id;
|
88
115
|
form.appendChild(input);
|
89
116
|
});
|
90
|
-
|
117
|
+
|
118
|
+
// Submit the form
|
91
119
|
form.submit();
|
92
|
-
}
|
120
|
+
}
|
93
121
|
#{' '}
|
94
|
-
function
|
122
|
+
function updateButtonStates() {
|
95
123
|
const checkboxes = document.getElementsByName('job_ids[]');
|
96
124
|
const checked = Array.from(checkboxes).some(cb => cb.checked);
|
97
125
|
executeButton.disabled = !checked;
|
126
|
+
rejectButton.disabled = !checked;
|
98
127
|
}
|
99
128
|
#{' '}
|
100
|
-
// Initialize button
|
101
|
-
|
129
|
+
// Initialize button states
|
130
|
+
updateButtonStates();
|
102
131
|
});
|
103
132
|
</script>
|
104
133
|
HTML
|
@@ -130,7 +159,7 @@ module SolidQueueMonitor
|
|
130
159
|
<<-HTML
|
131
160
|
<tr>
|
132
161
|
<td>
|
133
|
-
<input type="checkbox" name="job_ids[]" value="#{execution.id}"
|
162
|
+
<input type="checkbox" name="job_ids[]" value="#{execution.id}">
|
134
163
|
</td>
|
135
164
|
<td>#{execution.job.class_name}</td>
|
136
165
|
<td>#{execution.queue_name}</td>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SolidQueueMonitor
|
4
|
+
class RejectJobService
|
5
|
+
def call(id)
|
6
|
+
execution = SolidQueue::ScheduledExecution.find(id)
|
7
|
+
reject_job(execution)
|
8
|
+
end
|
9
|
+
|
10
|
+
def reject_many(ids)
|
11
|
+
return { success: false, message: 'No jobs selected' } if ids.blank?
|
12
|
+
|
13
|
+
success_count = 0
|
14
|
+
failed_count = 0
|
15
|
+
|
16
|
+
ids.each do |id|
|
17
|
+
execution = SolidQueue::ScheduledExecution.find_by(id: id)
|
18
|
+
if execution
|
19
|
+
reject_job(execution)
|
20
|
+
success_count += 1
|
21
|
+
else
|
22
|
+
failed_count += 1
|
23
|
+
end
|
24
|
+
rescue StandardError
|
25
|
+
failed_count += 1
|
26
|
+
end
|
27
|
+
|
28
|
+
if success_count.positive? && failed_count.zero?
|
29
|
+
{ success: true, message: 'All selected jobs have been rejected' }
|
30
|
+
elsif success_count.positive? && failed_count.positive?
|
31
|
+
{ success: true, message: "#{success_count} jobs rejected, #{failed_count} failed" }
|
32
|
+
else
|
33
|
+
{ success: false, message: 'Failed to reject jobs' }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def reject_job(execution)
|
40
|
+
ActiveRecord::Base.transaction do
|
41
|
+
# Mark the associated job as finished to indicate it was rejected
|
42
|
+
execution.job.update!(finished_at: Time.current)
|
43
|
+
|
44
|
+
# Remove the scheduled execution
|
45
|
+
execution.destroy
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/config/routes.rb
CHANGED
@@ -11,6 +11,7 @@ SolidQueueMonitor::Engine.routes.draw do
|
|
11
11
|
resources :queues, only: [:index]
|
12
12
|
|
13
13
|
post 'execute_jobs', to: 'scheduled_jobs#create', as: :execute_jobs
|
14
|
+
post 'reject_jobs', to: 'scheduled_jobs#reject_all', as: :reject_jobs
|
14
15
|
|
15
16
|
post 'retry_failed_job/:id', to: 'failed_jobs#retry', as: :retry_failed_job
|
16
17
|
post 'discard_failed_job/:id', to: 'failed_jobs#discard', as: :discard_failed_job
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solid_queue_monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vishal Sadriya
|
@@ -45,6 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- LICENSE
|
48
49
|
- README.md
|
49
50
|
- Rakefile
|
50
51
|
- app/controllers/solid_queue_monitor/application_controller.rb
|
@@ -70,6 +71,7 @@ files:
|
|
70
71
|
- app/services/solid_queue_monitor/failed_job_service.rb
|
71
72
|
- app/services/solid_queue_monitor/html_generator.rb
|
72
73
|
- app/services/solid_queue_monitor/pagination_service.rb
|
74
|
+
- app/services/solid_queue_monitor/reject_job_service.rb
|
73
75
|
- app/services/solid_queue_monitor/stats_calculator.rb
|
74
76
|
- app/services/solid_queue_monitor/status_calculator.rb
|
75
77
|
- app/services/solid_queue_monitor/stylesheet_generator.rb
|