mission_control-jobs 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/app/assets/stylesheets/mission_control/jobs/application.css +2 -16
- data/app/controllers/mission_control/jobs/application_controller.rb +8 -0
- data/app/helpers/mission_control/jobs/application_helper.rb +1 -1
- data/app/helpers/mission_control/jobs/{ui_helper.rb → interface_helper.rb} +1 -1
- data/app/models/mission_control/jobs/recurring_task.rb +1 -1
- data/app/views/mission_control/jobs/recurring_tasks/_general_information.html.erb +29 -8
- data/app/views/mission_control/jobs/recurring_tasks/_recurring_task.html.erb +7 -3
- data/lib/active_job/queue_adapters/solid_queue_ext/recurring_tasks.rb +16 -20
- data/lib/active_job/queue_adapters/solid_queue_ext.rb +1 -1
- data/lib/mission_control/jobs/engine.rb +4 -0
- data/lib/mission_control/jobs/version.rb +1 -1
- metadata +19 -6
- data/app/assets/config/mission_control_jobs_manifest.js +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7d0d51d0662e0351ff33ed1b2a480a7f1d11c593eefbe89a630a980de5a1b24
|
4
|
+
data.tar.gz: a9c05be3a1b2b0975c3d7095ac3d3433c502b5afd87a942996ced2aa01485b6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de6116de1a5b4fd7b87d4aba9e245953147edaa3cf8dd9e5e464be815dec79d74977dbe60b638246a6fe3625f9cb050aaceb9cd09c73eda857b1756006700328
|
7
|
+
data.tar.gz: 4e133652b36ec90c22fc9e77170e985d6b18c1a68ae73ce43361a1ea5be9c14820f8db594ce713bbcf7a8a6540766f9f6d4a5974dd51a9510fb94040f57fde76
|
data/README.md
CHANGED
@@ -65,6 +65,7 @@ This library extends Active Job with a querying interface and the following sett
|
|
65
65
|
## Adapter Specifics
|
66
66
|
|
67
67
|
- **Resque**: Queue pausing is supported only if you have `resque-pause` installed in your project
|
68
|
+
- **Solid Queue**: Requires version >= 0.9.
|
68
69
|
|
69
70
|
## Advanced configuration
|
70
71
|
|
@@ -1,16 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
16
|
-
|
1
|
+
@import url("./forms.css");
|
2
|
+
@import url("./jobs.css");
|
@@ -1,6 +1,14 @@
|
|
1
1
|
class MissionControl::Jobs::ApplicationController < MissionControl::Jobs.base_controller_class.constantize
|
2
|
+
ActionController::Base::MODULES.each do |mod|
|
3
|
+
include mod unless self < mod
|
4
|
+
end
|
5
|
+
|
2
6
|
layout "mission_control/jobs/application"
|
3
7
|
|
8
|
+
# Include helpers if not already included
|
9
|
+
helper MissionControl::Jobs::ApplicationHelper unless self < MissionControl::Jobs::ApplicationHelper
|
10
|
+
helper Importmap::ImportmapTagsHelper unless self < Importmap::ImportmapTagsHelper
|
11
|
+
|
4
12
|
include MissionControl::Jobs::ApplicationScoped, MissionControl::Jobs::NotFoundRedirections
|
5
13
|
include MissionControl::Jobs::AdapterFeatures
|
6
14
|
|
@@ -3,6 +3,6 @@ module MissionControl::Jobs
|
|
3
3
|
# Explicit helper inclusion because ApplicationController inherits from the host app.
|
4
4
|
#
|
5
5
|
# We can't rely on +config.action_controller.include_all_helpers = true+ in the host app.
|
6
|
-
include DatesHelper, JobsHelper, NavigationHelper,
|
6
|
+
include DatesHelper, JobsHelper, NavigationHelper, InterfaceHelper
|
7
7
|
end
|
8
8
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class MissionControl::Jobs::RecurringTask
|
2
2
|
include ActiveModel::Model
|
3
3
|
|
4
|
-
attr_accessor :id, :job_class_name, :arguments, :schedule, :last_enqueued_at
|
4
|
+
attr_accessor :id, :job_class_name, :command, :arguments, :schedule, :last_enqueued_at, :queue_name, :priority
|
5
5
|
|
6
6
|
def initialize(queue_adapter: ActiveJob::Base.queue_adapter, **kwargs)
|
7
7
|
@queue_adapter = queue_adapter
|
@@ -1,16 +1,37 @@
|
|
1
1
|
<table class="table">
|
2
2
|
<tbody>
|
3
|
-
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<
|
10
|
-
|
3
|
+
<% if recurring_task.job_class_name.present? %>
|
4
|
+
<tr>
|
5
|
+
<th>Job class</th>
|
6
|
+
<td><%= recurring_task.job_class_name %></td>
|
7
|
+
</tr>
|
8
|
+
|
9
|
+
<tr>
|
10
|
+
<th>Arguments</th>
|
11
|
+
<td><div class="is-family-monospace"><%= recurring_task.arguments.join(",") %></div></td>
|
12
|
+
</tr>
|
13
|
+
<% elsif recurring_task.command.present? %>
|
14
|
+
<tr>
|
15
|
+
<th>Command</th>
|
16
|
+
<td><div class="is-family-monospace"><%= recurring_task.command %></div></td>
|
17
|
+
</tr>
|
18
|
+
<% end %>
|
19
|
+
|
11
20
|
<tr>
|
12
21
|
<th>Schedule</th>
|
13
22
|
<td><%= recurring_task.schedule %></td>
|
14
23
|
</tr>
|
24
|
+
<% if recurring_task.queue_name.present? %>
|
25
|
+
<tr>
|
26
|
+
<th>Queue</th>
|
27
|
+
<td><%= recurring_task.queue_name %></td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
<% if recurring_task.priority.present? %>
|
31
|
+
<tr>
|
32
|
+
<th>Priority</th>
|
33
|
+
<td><%= recurring_task.priority %></td>
|
34
|
+
</tr>
|
35
|
+
<% end %>
|
15
36
|
</tbody>
|
16
37
|
</table>
|
@@ -3,10 +3,14 @@
|
|
3
3
|
<%= link_to recurring_task.id, application_recurring_task_path(@application, recurring_task.id) %>
|
4
4
|
</td>
|
5
5
|
<td>
|
6
|
-
|
6
|
+
<% if recurring_task.job_class_name.present? %>
|
7
|
+
<%= recurring_task.job_class_name %>
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
<% if recurring_task.arguments.present? %>
|
10
|
+
<div class="is-family-monospace"><%= recurring_task.arguments.join(",") %></div>
|
11
|
+
<% end %>
|
12
|
+
<% elsif recurring_task.command.present? %>
|
13
|
+
<div class="is-family-monospace"><%= recurring_task.command %></div>
|
10
14
|
<% end %>
|
11
15
|
</td>
|
12
16
|
<td> <%= recurring_task.schedule %> </td>
|
@@ -4,36 +4,32 @@ module ActiveJob::QueueAdapters::SolidQueueExt::RecurringTasks
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def recurring_tasks
|
7
|
-
tasks =
|
8
|
-
last_enqueued_at_times = recurring_task_last_enqueued_at(tasks.
|
7
|
+
tasks = SolidQueue::RecurringTask.all
|
8
|
+
last_enqueued_at_times = recurring_task_last_enqueued_at(tasks.map(&:key))
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
last_enqueued_at: last_enqueued_at_times[task_id]
|
10
|
+
tasks.collect do |task|
|
11
|
+
recurring_task_attributes_from_solid_queue_recurring_task(task).merge \
|
12
|
+
last_enqueued_at: last_enqueued_at_times[task.key]
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
17
16
|
def find_recurring_task(task_id)
|
18
|
-
if
|
19
|
-
|
20
|
-
|
21
|
-
last_enqueued_at: recurring_task_last_enqueued_at(task_id).values&.first
|
17
|
+
if task = SolidQueue::RecurringTask.find_by(key: task_id)
|
18
|
+
recurring_task_attributes_from_solid_queue_recurring_task(task).merge \
|
19
|
+
last_enqueued_at: recurring_task_last_enqueued_at(task.key).values&.first
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
23
|
private
|
26
|
-
def
|
27
|
-
SolidQueue::Process.where(kind: "Dispatcher").flat_map do |process|
|
28
|
-
process.metadata["recurring_schedule"]
|
29
|
-
end.compact.reduce({}, &:merge)
|
30
|
-
end
|
31
|
-
|
32
|
-
def recurring_task_attributes_from_solid_queue_task_attributes(task_attributes)
|
24
|
+
def recurring_task_attributes_from_solid_queue_recurring_task(task)
|
33
25
|
{
|
34
|
-
|
35
|
-
|
36
|
-
|
26
|
+
id: task.key,
|
27
|
+
job_class_name: task.class_name,
|
28
|
+
command: task.command,
|
29
|
+
arguments: task.arguments,
|
30
|
+
schedule: task.schedule,
|
31
|
+
queue_name: task.queue_name,
|
32
|
+
priority: task.priority
|
37
33
|
}
|
38
34
|
end
|
39
35
|
|
@@ -118,7 +118,7 @@ module ActiveJob::QueueAdapters::SolidQueueExt
|
|
118
118
|
ActiveJob::ExecutionError.new \
|
119
119
|
error_class: solid_queue_job.failed_execution.exception_class,
|
120
120
|
message: solid_queue_job.failed_execution.message,
|
121
|
-
backtrace: solid_queue_job.failed_execution.backtrace
|
121
|
+
backtrace: solid_queue_job.failed_execution.backtrace || []
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -4,12 +4,15 @@ require "mission_control/jobs/engine"
|
|
4
4
|
require "importmap-rails"
|
5
5
|
require "turbo-rails"
|
6
6
|
require "stimulus-rails"
|
7
|
+
require "propshaft"
|
7
8
|
|
8
9
|
module MissionControl
|
9
10
|
module Jobs
|
10
11
|
class Engine < ::Rails::Engine
|
11
12
|
isolate_namespace MissionControl::Jobs
|
12
13
|
|
14
|
+
config.middleware.use ActionDispatch::Flash unless config.action_dispatch.flash
|
15
|
+
|
13
16
|
config.mission_control = ActiveSupport::OrderedOptions.new unless config.try(:mission_control)
|
14
17
|
config.mission_control.jobs = ActiveSupport::OrderedOptions.new
|
15
18
|
|
@@ -87,6 +90,7 @@ module MissionControl
|
|
87
90
|
end
|
88
91
|
|
89
92
|
initializer "mission_control-jobs.assets" do |app|
|
93
|
+
app.config.assets.paths << root.join("app/assets/stylesheets")
|
90
94
|
app.config.assets.paths << root.join("app/javascript")
|
91
95
|
app.config.assets.precompile += %w[ mission_control_jobs_manifest ]
|
92
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mission_control-jobs
|
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
|
- Jorge Manrubia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '7.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: propshaft
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: importmap-rails
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +114,14 @@ dependencies:
|
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
117
|
+
version: '0.9'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
124
|
+
version: '0.9'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: selenium-webdriver
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -286,7 +300,6 @@ files:
|
|
286
300
|
- MIT-LICENSE
|
287
301
|
- README.md
|
288
302
|
- Rakefile
|
289
|
-
- app/assets/config/mission_control_jobs_manifest.js
|
290
303
|
- app/assets/stylesheets/mission_control/jobs/application.css
|
291
304
|
- app/assets/stylesheets/mission_control/jobs/forms.css
|
292
305
|
- app/assets/stylesheets/mission_control/jobs/jobs.css
|
@@ -310,9 +323,9 @@ files:
|
|
310
323
|
- app/controllers/mission_control/jobs/workers_controller.rb
|
311
324
|
- app/helpers/mission_control/jobs/application_helper.rb
|
312
325
|
- app/helpers/mission_control/jobs/dates_helper.rb
|
326
|
+
- app/helpers/mission_control/jobs/interface_helper.rb
|
313
327
|
- app/helpers/mission_control/jobs/jobs_helper.rb
|
314
328
|
- app/helpers/mission_control/jobs/navigation_helper.rb
|
315
|
-
- app/helpers/mission_control/jobs/ui_helper.rb
|
316
329
|
- app/javascript/mission_control/jobs/application.js
|
317
330
|
- app/javascript/mission_control/jobs/controllers/application.js
|
318
331
|
- app/javascript/mission_control/jobs/controllers/form_controller.js
|