que-view 0.3.7 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/que/view/application_helper.rb +28 -0
- data/app/views/que/view/jobs/index.html.erb +2 -6
- data/app/views/que/view/jobs/show.html.erb +2 -4
- data/db/migrate/20240731072914_create_que_schema.rb +13 -0
- data/lib/que/view/dsl.rb +3 -3
- data/lib/que/view/version.rb +1 -1
- metadata +59 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48aaed2dc98a7238f4baa10b5f12c0c67dbd03a5ea588a6d184d95f077f356dd
|
4
|
+
data.tar.gz: 27ed335bcfa4b1a21380438ab1fee77e6f92f123828b1d88d8f8ace39a269dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef87394a2f147a65384f2aa44d8695a734f3ae9c1c451d25bb763dd45a0cd582269597f21809c5cc1847ad1a1113dca4940baac8751cfe1ccd08910222929d1e
|
7
|
+
data.tar.gz: 4f83aca9ad32a0dd37b6948d69511f6193412f9bf3221b0db53001e2f37535cc6aac053bc252612005af120270c059e6f3aa1889128f41dd1e0e466c85e268b7
|
@@ -15,6 +15,34 @@ module Que
|
|
15
15
|
|
16
16
|
job[:last_error_message].lines.first || ''
|
17
17
|
end
|
18
|
+
|
19
|
+
def humanized_job_args(job)
|
20
|
+
case job[:job_class]
|
21
|
+
when 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper' then active_job_args(job)
|
22
|
+
else que_args(job)
|
23
|
+
end.join('<br />').html_safe
|
24
|
+
end
|
25
|
+
|
26
|
+
def humanized_enqueued_at(job)
|
27
|
+
case job[:job_class]
|
28
|
+
when 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper'
|
29
|
+
job.dig(:args, 0, :enqueued_at).to_time.strftime('%Y-%m-%d %H:%M:%S')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def active_job_args(job)
|
36
|
+
job.dig(:args, 0, :arguments)&.map do |arg|
|
37
|
+
next arg.except(:_aj_ruby2_keywords, :_aj_symbol_keys) if arg.is_a?(Hash)
|
38
|
+
|
39
|
+
arg
|
40
|
+
end || []
|
41
|
+
end
|
42
|
+
|
43
|
+
def que_args(job)
|
44
|
+
job[:args].push(job[:kwargs])
|
45
|
+
end
|
18
46
|
end
|
19
47
|
end
|
20
48
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<h1><%= params[:status]
|
1
|
+
<h1><%= params[:status]&.capitalize %> jobs</h1>
|
2
2
|
<%= form_with url: jobs_path, method: :get, class: 'search-form' do |form| %>
|
3
3
|
<%= form.hidden_field :status, value: params[:status] %>
|
4
4
|
<div class="row">
|
@@ -50,11 +50,7 @@
|
|
50
50
|
<td><%= humanized_job_class(job) %></td>
|
51
51
|
<td><%= job[:queue] %></td>
|
52
52
|
<td><%= job[:run_at].strftime("%Y-%m-%d %H:%M:%S") %></td>
|
53
|
-
<td>
|
54
|
-
<% Array(job.dig(:args, 0, :arguments)).each do |argument| %>
|
55
|
-
<p><%= argument %></p>
|
56
|
-
<% end %>
|
57
|
-
</td>
|
53
|
+
<td><%= humanized_job_args(job) %></td>
|
58
54
|
<% if params[:status] == 'failing' %>
|
59
55
|
<td><%= job[:error_count] %></td>
|
60
56
|
<td><%= format_error(job) %></td>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
</tr>
|
21
21
|
<tr>
|
22
22
|
<th>Enqueued at</th>
|
23
|
-
<td><%= @job
|
23
|
+
<td><%= humanized_enqueued_at(@job) %></td>
|
24
24
|
</tr>
|
25
25
|
<tr>
|
26
26
|
<th>Run at</th>
|
@@ -33,9 +33,7 @@
|
|
33
33
|
<tr>
|
34
34
|
<th>Args</th>
|
35
35
|
<td>
|
36
|
-
|
37
|
-
<p><%= argument %></p>
|
38
|
-
<% end %>
|
36
|
+
<%= humanized_job_args(@job) %>
|
39
37
|
</td>
|
40
38
|
</tr>
|
41
39
|
<tr>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateQueSchema < ActiveRecord::Migration[7.1]
|
2
|
+
def up
|
3
|
+
# Whenever you use Que in a migration, always specify the version you're
|
4
|
+
# migrating to. If you're unsure what the current version is, check the
|
5
|
+
# changelog.
|
6
|
+
Que.migrate!(version: 7)
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
# Migrate to version 0 to remove Que entirely.
|
11
|
+
Que.migrate!(version: 0)
|
12
|
+
end
|
13
|
+
end
|
data/lib/que/view/dsl.rb
CHANGED
@@ -95,7 +95,7 @@ module Que
|
|
95
95
|
SELECT count(*) AS total,
|
96
96
|
count(locks.job_id) AS running,
|
97
97
|
coalesce(sum((error_count > 0 AND locks.job_id IS NULL AND expired_at IS NULL)::int), 0) AS failing,
|
98
|
-
coalesce(sum((error_count = 0 AND locks.job_id IS NULL)::int), 0) AS scheduled,
|
98
|
+
coalesce(sum((error_count = 0 AND locks.job_id IS NULL AND finished_at IS NULL AND expired_at IS NULL)::int), 0) AS scheduled,
|
99
99
|
coalesce(sum((finished_at IS NOT NULL)::int), 0) AS finished,
|
100
100
|
coalesce(sum((expired_at IS NOT NULL)::int), 0) AS expired
|
101
101
|
FROM que_jobs
|
@@ -121,7 +121,7 @@ module Que
|
|
121
121
|
WHEN expired_at IS NOT NULL THEN 'expired'
|
122
122
|
WHEN finished_at IS NOT NULL THEN 'finished'
|
123
123
|
WHEN locks.job_id IS NULL AND error_count > 0 AND expired_at IS NULL THEN 'failing'
|
124
|
-
WHEN locks.job_id IS NULL AND error_count = 0 THEN 'scheduled'
|
124
|
+
WHEN locks.job_id IS NULL AND error_count = 0 AND finished_at IS NULL AND expired_at IS NULL THEN 'scheduled'
|
125
125
|
ELSE 'running'
|
126
126
|
END status
|
127
127
|
FROM que_jobs
|
@@ -135,7 +135,7 @@ module Que
|
|
135
135
|
WHEN expired_at IS NOT NULL THEN 'expired'
|
136
136
|
WHEN finished_at IS NOT NULL THEN 'finished'
|
137
137
|
WHEN locks.job_id IS NULL AND error_count > 0 AND expired_at IS NULL THEN 'failing'
|
138
|
-
WHEN locks.job_id IS NULL AND error_count = 0 THEN 'scheduled'
|
138
|
+
WHEN locks.job_id IS NULL AND error_count = 0 AND finished_at IS NULL AND expired_at IS NULL THEN 'scheduled'
|
139
139
|
ELSE 'running'
|
140
140
|
END
|
141
141
|
SQL
|
data/lib/que/view/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: que-view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdanov Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: que
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.39'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-factory_bot
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rubocop-performance
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +150,48 @@ dependencies:
|
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0.6'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-rspec
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '3.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '3.0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rubocop-rspec_rails
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '2.0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '2.0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: sassc-rails
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
139
195
|
description: Rails engine as web interface for Que for inspecting jobs.
|
140
196
|
email:
|
141
197
|
- kortirso@gmail.com
|
@@ -159,6 +215,7 @@ files:
|
|
159
215
|
- app/views/que/view/queue_metrics/index.html.erb
|
160
216
|
- app/views/que/view/welcome/index.html.erb
|
161
217
|
- config/routes.rb
|
218
|
+
- db/migrate/20240731072914_create_que_schema.rb
|
162
219
|
- lib/que/view.rb
|
163
220
|
- lib/que/view/configuration.rb
|
164
221
|
- lib/que/view/dsl.rb
|