good_job 2.11.2 → 2.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +61 -0
- data/README.md +12 -17
- data/engine/app/controllers/good_job/{base_controller.rb → application_controller.rb} +20 -2
- data/engine/app/controllers/good_job/cron_entries_controller.rb +1 -1
- data/engine/app/controllers/good_job/executions_controller.rb +1 -1
- data/engine/app/controllers/good_job/jobs_controller.rb +1 -1
- data/engine/app/controllers/good_job/processes_controller.rb +1 -1
- data/engine/app/views/good_job/shared/_alert.erb +13 -0
- data/engine/app/views/good_job/shared/_footer.erb +15 -0
- data/engine/app/views/good_job/shared/_navbar.erb +44 -0
- data/engine/app/views/layouts/good_job/application.html.erb +31 -0
- data/engine/config/locales/en.yml +53 -0
- data/engine/config/locales/es.yml +53 -0
- data/engine/config/locales/ru.yaml +53 -0
- data/lib/good_job/adapter.rb +8 -2
- data/lib/good_job/cli.rb +5 -5
- data/lib/good_job/cron_entry.rb +11 -1
- data/lib/good_job/poller.rb +0 -3
- data/lib/good_job/version.rb +1 -1
- metadata +10 -4
- data/engine/app/views/layouts/good_job/base.html.erb +0 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53c32b60d9ee966dd7dcb05f5add8f3ab7bcd666a224019d91b0e07e54a366b4
|
4
|
+
data.tar.gz: 7abcb16ceb51272d9fc6297491c55500b97a2839c6158c24d9779841b179c721
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a65fc3d71709b9c4ee611f79e3678b9ef910d8480757037fd25f83f9d783eff40134b0b15fad873d31fb60c576872a93fd64bc2c7f0f2ba9b4ce0d751984925c
|
7
|
+
data.tar.gz: eea513879d7cdbb872938469a62672d886156a92f63a61c88e8a62c816a218bc325be1b705d1e1f7f7a43626ba2910bd108ea14303b6a15b59674a85eddf1f58
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,66 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v2.12.1](https://github.com/bensheldon/good_job/tree/v2.12.1) (2022-04-18)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.12.0...v2.12.1)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Dashboard: adding Russian translation [\#565](https://github.com/bensheldon/good_job/pull/565) ([skatkov](https://github.com/skatkov))
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- I18n::InvalidLocale \(:en is not a valid locale\): [\#549](https://github.com/bensheldon/good_job/issues/549)
|
14
|
+
- FIX: make 'default\_url\_options' method private [\#562](https://github.com/bensheldon/good_job/pull/562) ([friendlyantz](https://github.com/friendlyantz))
|
15
|
+
|
16
|
+
**Closed issues:**
|
17
|
+
|
18
|
+
- Exponential backoff by default? [\#563](https://github.com/bensheldon/good_job/issues/563)
|
19
|
+
- Finished without Error [\#552](https://github.com/bensheldon/good_job/issues/552)
|
20
|
+
- Track processes in the database [\#421](https://github.com/bensheldon/good_job/issues/421)
|
21
|
+
|
22
|
+
**Merged pull requests:**
|
23
|
+
|
24
|
+
- Remove WIP comments from dashboard [\#566](https://github.com/bensheldon/good_job/pull/566) ([bkeepers](https://github.com/bkeepers))
|
25
|
+
- Add i18n-tasks to linter, add binstub and move config to project root [\#559](https://github.com/bensheldon/good_job/pull/559) ([bensheldon](https://github.com/bensheldon))
|
26
|
+
|
27
|
+
## [v2.12.0](https://github.com/bensheldon/good_job/tree/v2.12.0) (2022-04-05)
|
28
|
+
|
29
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.11.3...v2.12.0)
|
30
|
+
|
31
|
+
**Closed issues:**
|
32
|
+
|
33
|
+
- TimeTask timeouts are now ignored as these were not able to be implemented correctly [\#555](https://github.com/bensheldon/good_job/issues/555)
|
34
|
+
- undefined method `relative\_time' when include\_all\_helpers is false [\#550](https://github.com/bensheldon/good_job/issues/550)
|
35
|
+
- ArgumentError: wrong number of arguments \(given 1, expected 0; required keyword: schedule\) - cron [\#546](https://github.com/bensheldon/good_job/issues/546)
|
36
|
+
|
37
|
+
**Merged pull requests:**
|
38
|
+
|
39
|
+
- Deprecate Adapter configuration of job execution/cron [\#558](https://github.com/bensheldon/good_job/pull/558) ([bensheldon](https://github.com/bensheldon))
|
40
|
+
- Remove usage of Concurrent::TimerTask's timeout\_interval [\#557](https://github.com/bensheldon/good_job/pull/557) ([bensheldon](https://github.com/bensheldon))
|
41
|
+
- Include locale in html lang attribute [\#556](https://github.com/bensheldon/good_job/pull/556) ([bensheldon](https://github.com/bensheldon))
|
42
|
+
- Rename `GoodJob::BaseController` to `GoodJob::ApplicationController` [\#553](https://github.com/bensheldon/good_job/pull/553) ([shouichi](https://github.com/shouichi))
|
43
|
+
- Internationalize/I18n the Dashboard Engine [\#497](https://github.com/bensheldon/good_job/pull/497) ([JuanVqz](https://github.com/JuanVqz))
|
44
|
+
|
45
|
+
## [v2.11.3](https://github.com/bensheldon/good_job/tree/v2.11.3) (2022-03-30)
|
46
|
+
|
47
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.11.2...v2.11.3)
|
48
|
+
|
49
|
+
**Fixed bugs:**
|
50
|
+
|
51
|
+
- Add explicit `kwargs:` key to cron configuration [\#548](https://github.com/bensheldon/good_job/pull/548) ([bensheldon](https://github.com/bensheldon))
|
52
|
+
|
53
|
+
**Closed issues:**
|
54
|
+
|
55
|
+
- How to run clean up preserved jobs in cron? [\#541](https://github.com/bensheldon/good_job/issues/541)
|
56
|
+
- Erroring with "Too many open files" when good\_job tries reconnecting to database [\#530](https://github.com/bensheldon/good_job/issues/530)
|
57
|
+
- Can't cast Array [\#529](https://github.com/bensheldon/good_job/issues/529)
|
58
|
+
|
59
|
+
**Merged pull requests:**
|
60
|
+
|
61
|
+
- Use bundle add instead [\#542](https://github.com/bensheldon/good_job/pull/542) ([glaucocustodio](https://github.com/glaucocustodio))
|
62
|
+
- Update Readme to better explain queues, pools, threads, and database connections; update CLI to frontload queue option [\#539](https://github.com/bensheldon/good_job/pull/539) ([bensheldon](https://github.com/bensheldon))
|
63
|
+
|
3
64
|
## [v2.11.2](https://github.com/bensheldon/good_job/tree/v2.11.2) (2022-03-03)
|
4
65
|
|
5
66
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v2.11.1...v2.11.2)
|
data/README.md
CHANGED
@@ -65,16 +65,10 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla
|
|
65
65
|
|
66
66
|
## Set up
|
67
67
|
|
68
|
-
1. Add `good_job` to your application's Gemfile:
|
68
|
+
1. Add `good_job` to your application's Gemfile and install the gem:
|
69
69
|
|
70
|
-
```
|
71
|
-
|
72
|
-
```
|
73
|
-
|
74
|
-
1. Install the gem:
|
75
|
-
|
76
|
-
```bash
|
77
|
-
bundle install
|
70
|
+
```sh
|
71
|
+
bundle add good_job
|
78
72
|
```
|
79
73
|
|
80
74
|
1. Run the GoodJob install generator. This will generate a database migration to create a table for GoodJob's job records:
|
@@ -165,8 +159,8 @@ Usage:
|
|
165
159
|
good_job start
|
166
160
|
|
167
161
|
Options:
|
168
|
-
[--
|
169
|
-
[--
|
162
|
+
[--queues=QUEUE_LIST] # Queues or pools to work from. (env var: GOOD_JOB_QUEUES, default: *)
|
163
|
+
[--max-threads=COUNT] # Default number of threads per pool to use for working jobs. (env var: GOOD_JOB_MAX_THREADS, default: 5)
|
170
164
|
[--poll-interval=SECONDS] # Interval between polls for available jobs in seconds (env var: GOOD_JOB_POLL_INTERVAL, default: 1)
|
171
165
|
[--max-cache=COUNT] # Maximum number of scheduled jobs to cache in memory (env var: GOOD_JOB_MAX_CACHE, default: 10000)
|
172
166
|
[--shutdown-timeout=SECONDS] # Number of seconds to wait for jobs to finish when shutting down before stopping the thread. (env var: GOOD_JOB_SHUTDOWN_TIMEOUT, default: -1 (forever))
|
@@ -230,12 +224,12 @@ Rails.application.configure do
|
|
230
224
|
config.good_job.retry_on_unhandled_error = false
|
231
225
|
config.good_job.on_thread_error = -> (exception) { Raven.capture_exception(exception) }
|
232
226
|
config.good_job.execution_mode = :async
|
227
|
+
config.good_job.queues = '*'
|
233
228
|
config.good_job.max_threads = 5
|
234
229
|
config.good_job.poll_interval = 30 # seconds
|
235
230
|
config.good_job.shutdown_timeout = 25 # seconds
|
236
231
|
config.good_job.enable_cron = true
|
237
232
|
config.good_job.cron = { example: { cron: '0 * * * *', class: 'ExampleJob' } }
|
238
|
-
config.good_job.queues = '*'
|
239
233
|
|
240
234
|
# ...or all at once.
|
241
235
|
config.good_job = {
|
@@ -243,6 +237,7 @@ Rails.application.configure do
|
|
243
237
|
retry_on_unhandled_error: false,
|
244
238
|
on_thread_error: -> (exception) { Raven.capture_exception(exception) },
|
245
239
|
execution_mode: :async,
|
240
|
+
queues: '*',
|
246
241
|
max_threads: 5,
|
247
242
|
poll_interval: 30,
|
248
243
|
shutdown_timeout: 25,
|
@@ -253,7 +248,6 @@ Rails.application.configure do
|
|
253
248
|
class: 'ExampleJob'
|
254
249
|
},
|
255
250
|
},
|
256
|
-
queues: '*',
|
257
251
|
}
|
258
252
|
end
|
259
253
|
```
|
@@ -265,8 +259,8 @@ Available configuration options are:
|
|
265
259
|
- `:external` causes the adapter to enqueue jobs, but not execute them. When using this option (the default for production environments), you’ll need to use the command-line tool to actually execute your jobs.
|
266
260
|
- `:async` (or `:async_server`) executes jobs in separate threads within the Rails web server process (`bundle exec rails server`). It can be more economical for small workloads because you don’t need a separate machine or environment for running your jobs, but if your web server is under heavy load or your jobs require a lot of resources, you should choose `:external` instead. When not in the Rails web server, jobs will execute in `:external` mode to ensure jobs are not executed within `rails console`, `rails db:migrate`, `rails assets:prepare`, etc.
|
267
261
|
- `:async_all` executes jobs in separate threads in _any_ Rails process.
|
268
|
-
- `
|
269
|
-
- `
|
262
|
+
- `queues` (string) sets queues or pools to execute jobs. You can also set this with the environment variable `GOOD_JOB_QUEUES`.
|
263
|
+
- `max_threads` (integer) sets the default number of threads per pool to use for working jobs. You can also set this with the environment variable `GOOD_JOB_MAX_THREADS`.
|
270
264
|
- `poll_interval` (integer) sets the number of seconds between polls for jobs when `execution_mode` is set to `:async`. You can also set this with the environment variable `GOOD_JOB_POLL_INTERVAL`. A poll interval of `-1` disables polling completely.
|
271
265
|
- `max_cache` (integer) sets the maximum number of scheduled jobs that will be stored in memory to reduce execution latency when also polling for scheduled jobs. Caching 10,000 scheduled jobs uses approximately 20MB of memory. You can also set this with the environment variable `GOOD_JOB_MAX_CACHE`.
|
272
266
|
- `shutdown_timeout` (float) number of seconds to wait for jobs to finish when shutting down before stopping the thread. Defaults to forever: `-1`. You can also set this with the environment variable `GOOD_JOB_SHUTDOWN_TIMEOUT`.
|
@@ -442,7 +436,8 @@ config.good_job.cron = {
|
|
442
436
|
frequent_task: { # each recurring job must have a unique key
|
443
437
|
cron: "*/15 * * * *", # cron-style scheduling format by fugit gem
|
444
438
|
class: "ExampleJob", # reference the Job class with a string
|
445
|
-
args: [42,
|
439
|
+
args: [42, "life"], # positional arguments to pass; can also be a proc e.g. `-> { [Time.now] }`
|
440
|
+
kwargs: { name: "Alice" }, # keyword arguments to pass; can also be a proc e.g. `-> { { name: NAMES.sample } }`
|
446
441
|
set: { priority: -10 }, # additional ActiveJob properties; can also be a lambda/proc e.g. `-> { { priority: [1,2].sample } }`
|
447
442
|
description: "Something helpful", # optional description that appears in Dashboard (coming soon!)
|
448
443
|
},
|
@@ -679,7 +674,7 @@ Each GoodJob execution thread requires its own database connection that is autom
|
|
679
674
|
|
680
675
|
```yaml
|
681
676
|
# config/database.yml
|
682
|
-
pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5).to_i + (ENV.fetch("GOOD_JOB_MAX_THREADS",
|
677
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5).to_i + 3 + (ENV.fetch("GOOD_JOB_MAX_THREADS", 5).to_i %>
|
683
678
|
```
|
684
679
|
|
685
680
|
To calculate the total number of the database connections you'll need:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module GoodJob
|
3
|
-
class
|
3
|
+
class ApplicationController < ActionController::Base
|
4
4
|
protect_from_forgery with: :exception
|
5
5
|
|
6
6
|
around_action :switch_locale
|
@@ -26,8 +26,26 @@ module GoodJob
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
+
def default_url_options(options = {})
|
30
|
+
{ locale: I18n.locale }.merge(options)
|
31
|
+
end
|
32
|
+
|
29
33
|
def switch_locale(&action)
|
30
|
-
I18n.with_locale(
|
34
|
+
I18n.with_locale(current_locale, &action)
|
35
|
+
end
|
36
|
+
|
37
|
+
def current_locale
|
38
|
+
if params[:locale]
|
39
|
+
params[:locale]
|
40
|
+
elsif good_job_available_locales.exclude?(I18n.default_locale) && I18n.available_locales.include?(:en)
|
41
|
+
:en
|
42
|
+
else
|
43
|
+
I18n.default_locale
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def good_job_available_locales
|
48
|
+
@_good_job_available_locales ||= GoodJob::Engine.root.join("config/locales").glob("*.yml").map { |path| File.basename(path, ".yml").to_sym }.uniq
|
31
49
|
end
|
32
50
|
end
|
33
51
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module GoodJob
|
3
|
-
class JobsController < GoodJob::
|
3
|
+
class JobsController < GoodJob::ApplicationController
|
4
4
|
rescue_from GoodJob::ActiveJobJob::AdapterNotGoodJobError,
|
5
5
|
GoodJob::ActiveJobJob::ActionForStateMismatchError,
|
6
6
|
with: :redirect_on_error
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module GoodJob
|
3
|
-
class ProcessesController < GoodJob::
|
3
|
+
class ProcessesController < GoodJob::ApplicationController
|
4
4
|
def index
|
5
5
|
@processes = GoodJob::Process.active.order(created_at: :desc) if GoodJob::Process.migrated?
|
6
6
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% if notice %>
|
2
|
+
<div class="alert alert-success alert-dismissible fade show d-flex align-items-center offset-md-3 col-6" role="alert">
|
3
|
+
<%= render "good_job/shared/icons/check", class: "flex-shrink-0 me-2" %>
|
4
|
+
<div><%= notice %></div>
|
5
|
+
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
6
|
+
</div>
|
7
|
+
<% elsif alert %>
|
8
|
+
<div class="alert alert-warning alert-dismissible fade show d-flex align-items-center offset-md-3 col-6" role="alert">
|
9
|
+
<%= render "good_job/shared/icons/exclamation", class: "flex-shrink-0 me-2" %>
|
10
|
+
<div><%= alert %></div>
|
11
|
+
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<footer class="footer mt-auto py-3 bg-light fixed-bottom" id="footer" data-gj-poll-replace>
|
2
|
+
<div class="container-fluid">
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-6">
|
5
|
+
<span class="text-muted">
|
6
|
+
<%= t(".last_update_html", time: Time.current.utc.iso8601) %>
|
7
|
+
</span>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="col-6 text-end">
|
11
|
+
<%= t(".wording") %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</footer>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
2
|
+
<div class="container-fluid">
|
3
|
+
<%= link_to t(".name"), root_path, class: "navbar-brand mb-0 h1" %>
|
4
|
+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
5
|
+
<span class="navbar-toggler-icon"></span>
|
6
|
+
</button>
|
7
|
+
|
8
|
+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
9
|
+
<ul class="navbar-nav me-auto">
|
10
|
+
<li class="nav-item">
|
11
|
+
<%= link_to t(".executions"), root_path, class: ["nav-link", ("active" if current_page?(root_path))] %>
|
12
|
+
</li>
|
13
|
+
<li class="nav-item">
|
14
|
+
<%= link_to t(".jobs"), jobs_path, class: ["nav-link", ("active" if current_page?(jobs_path))] %>
|
15
|
+
</li>
|
16
|
+
<li class="nav-item">
|
17
|
+
<%= link_to t(".cron_schedules"), cron_entries_path, class: ["nav-link", ("active" if current_page?(cron_entries_path))] %>
|
18
|
+
</li>
|
19
|
+
<li class="nav-item">
|
20
|
+
<%= link_to t(".processes"), processes_path, class: ["nav-link", ("active" if current_page?(processes_path))] %>
|
21
|
+
</li>
|
22
|
+
</ul>
|
23
|
+
<div class="nav-item pe-2">
|
24
|
+
<div class="form-check">
|
25
|
+
<input type="checkbox" id="toggle-poll" name="toggle-poll" data-gj-action='change#togglePoll' <%= 'checked' if params[:poll].present? %>>
|
26
|
+
<label for="toggle-poll"><%= t(".live_poll") %></label>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
<ul class="navbar-nav">
|
30
|
+
<li class="nav-item dropdown">
|
31
|
+
<a href="#" class="nav-link dropdown-toggle" type="button" id="localeOptions" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
32
|
+
<%= I18n.locale %>
|
33
|
+
</a>
|
34
|
+
|
35
|
+
<ul class="dropdown-menu" aria-labelledby="localeOptions">
|
36
|
+
<% I18n.available_locales.reject { |locale| locale == I18n.locale }.each do |locale| %>
|
37
|
+
<li><%= link_to locale, url_for(locale: locale), class: "dropdown-item" %></li>
|
38
|
+
<% end %>
|
39
|
+
</ul>
|
40
|
+
</li>
|
41
|
+
</ul>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</nav>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="<%= I18n.locale %>">
|
3
|
+
<head>
|
4
|
+
<title>Good Job Dashboard</title>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
<%= csp_meta_tag %>
|
9
|
+
|
10
|
+
<%# Assets must use *_url route helpers to avoid being overriden by config.asset_host %>
|
11
|
+
<%= stylesheet_link_tag bootstrap_url(format: :css, v: GoodJob::VERSION), skip_pipeline: true %>
|
12
|
+
<%= stylesheet_link_tag style_url(format: :css, v: GoodJob::VERSION) %>
|
13
|
+
|
14
|
+
<%= javascript_include_tag bootstrap_url(format: :js, v: GoodJob::VERSION), nonce: true %>
|
15
|
+
<%= javascript_include_tag chartjs_url(format: :js, v: GoodJob::VERSION), nonce: true %>
|
16
|
+
<%= javascript_include_tag scripts_url(format: :js, v: GoodJob::VERSION), nonce: true %>
|
17
|
+
|
18
|
+
<%= javascript_include_tag rails_ujs_url(format: :js, v: GoodJob::VERSION), nonce: true %>
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<%= render "good_job/shared/navbar" %>
|
22
|
+
|
23
|
+
<div class="container-fluid">
|
24
|
+
<%= render "good_job/shared/alert" %>
|
25
|
+
|
26
|
+
<%= yield %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<%= render "good_job/shared/footer" %>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
datetime:
|
4
|
+
distance_in_words:
|
5
|
+
about_x_hours:
|
6
|
+
one: about 1 hour
|
7
|
+
other: about %{count} hours
|
8
|
+
about_x_months:
|
9
|
+
one: about 1 month
|
10
|
+
other: about %{count} months
|
11
|
+
about_x_years:
|
12
|
+
one: about 1 year
|
13
|
+
other: about %{count} years
|
14
|
+
almost_x_years:
|
15
|
+
one: almost 1 year
|
16
|
+
other: almost %{count} years
|
17
|
+
half_a_minute: half a minute
|
18
|
+
less_than_x_minutes:
|
19
|
+
one: less than a minute
|
20
|
+
other: less than %{count} minutes
|
21
|
+
less_than_x_seconds:
|
22
|
+
one: less than 1 second
|
23
|
+
other: less than %{count} seconds
|
24
|
+
over_x_years:
|
25
|
+
one: over 1 year
|
26
|
+
other: over %{count} years
|
27
|
+
x_days:
|
28
|
+
one: 1 day
|
29
|
+
other: "%{count} days"
|
30
|
+
x_minutes:
|
31
|
+
one: 1 minute
|
32
|
+
other: "%{count} minutes"
|
33
|
+
x_months:
|
34
|
+
one: 1 month
|
35
|
+
other: "%{count} months"
|
36
|
+
x_seconds:
|
37
|
+
one: 1 second
|
38
|
+
other: "%{count} seconds"
|
39
|
+
x_years:
|
40
|
+
one: 1 year
|
41
|
+
other: "%{count} years"
|
42
|
+
good_job:
|
43
|
+
shared:
|
44
|
+
footer:
|
45
|
+
last_update_html: Last updated <time id="page-updated-at" datetime="%{time}">%{time}</time>
|
46
|
+
wording: Remember, you're doing a Good Job too!
|
47
|
+
navbar:
|
48
|
+
cron_schedules: Cron Schedules
|
49
|
+
executions: All Executions
|
50
|
+
jobs: All Jobs
|
51
|
+
live_poll: Live Poll
|
52
|
+
name: "GoodJob 👍"
|
53
|
+
processes: Processes
|
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
es:
|
3
|
+
datetime:
|
4
|
+
distance_in_words:
|
5
|
+
about_x_hours:
|
6
|
+
one: alrededor de 1 hora
|
7
|
+
other: alrededor de %{count} horas
|
8
|
+
about_x_months:
|
9
|
+
one: alrededor de 1 mes
|
10
|
+
other: alrededor de %{count} meses
|
11
|
+
about_x_years:
|
12
|
+
one: alrededor de 1 año
|
13
|
+
other: alrededor de %{count} años
|
14
|
+
almost_x_years:
|
15
|
+
one: casi 1 año
|
16
|
+
other: casi %{count} años
|
17
|
+
half_a_minute: medio minuto
|
18
|
+
less_than_x_minutes:
|
19
|
+
one: menos de un minuto
|
20
|
+
other: menos de %{count} minutos
|
21
|
+
less_than_x_seconds:
|
22
|
+
one: menos de 1 segundo
|
23
|
+
other: menos de %{count} segundos
|
24
|
+
over_x_years:
|
25
|
+
one: más de 1 año
|
26
|
+
other: durante %{count} años
|
27
|
+
x_days:
|
28
|
+
one: 1 día
|
29
|
+
other: "%{count} días"
|
30
|
+
x_minutes:
|
31
|
+
one: 1 minuto
|
32
|
+
other: "%{count} minutos"
|
33
|
+
x_months:
|
34
|
+
one: 1 mes
|
35
|
+
other: "%{count} meses"
|
36
|
+
x_seconds:
|
37
|
+
one: 1 segundo
|
38
|
+
other: "%{count} segundos"
|
39
|
+
x_years:
|
40
|
+
one: 1 año
|
41
|
+
other: "%{count} años"
|
42
|
+
good_job:
|
43
|
+
shared:
|
44
|
+
footer:
|
45
|
+
last_update_html: Última actualización <time id="page-updated-at" datetime="%{time}">%{time}</time>
|
46
|
+
wording: "¡Recuerda, también tú estás haciendo un buen trabajo!"
|
47
|
+
navbar:
|
48
|
+
cron_schedules: Tareas Programadas
|
49
|
+
executions: Ejecuciones
|
50
|
+
jobs: Tareas
|
51
|
+
live_poll: En vivo
|
52
|
+
name: "GoodJob 👍"
|
53
|
+
processes: Procesos
|
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
ru:
|
3
|
+
datetime:
|
4
|
+
distance_in_words:
|
5
|
+
about_x_hours:
|
6
|
+
one: около 1 часа
|
7
|
+
other: около %{count} часов
|
8
|
+
about_x_months:
|
9
|
+
one: около 1 месяца
|
10
|
+
other: около %{count} месяцев
|
11
|
+
about_x_years:
|
12
|
+
one: около 1 года
|
13
|
+
other: около %{count} лет
|
14
|
+
almost_x_years:
|
15
|
+
one: почти 1 год
|
16
|
+
other: почти %{count} года
|
17
|
+
half_a_minute: пол минуты
|
18
|
+
less_than_x_minutes:
|
19
|
+
one: меньше 1 минуты
|
20
|
+
other: меньше %{count} минут
|
21
|
+
less_than_x_seconds:
|
22
|
+
one: меньше 1 секунды
|
23
|
+
other: меньше %{count} секунд
|
24
|
+
over_x_years:
|
25
|
+
one: больше 1 года
|
26
|
+
other: больше %{count} лет
|
27
|
+
x_days:
|
28
|
+
one: 1 день
|
29
|
+
other: "%{count} дней"
|
30
|
+
x_minutes:
|
31
|
+
one: 1 минута
|
32
|
+
other: "%{count} минут"
|
33
|
+
x_months:
|
34
|
+
one: 1 месяц
|
35
|
+
other: "%{count} месяца"
|
36
|
+
x_seconds:
|
37
|
+
one: 1 секунда
|
38
|
+
other: "%{count} секунд"
|
39
|
+
x_years:
|
40
|
+
one: 1 год
|
41
|
+
other: "%{count} года"
|
42
|
+
good_job:
|
43
|
+
shared:
|
44
|
+
footer:
|
45
|
+
last_update_html: Последнее обновление <time id="page-updated-at" datetime="%{time}">%{time}</time>
|
46
|
+
wording: Запомни, ты делаешь Good Job тоже!
|
47
|
+
navbar:
|
48
|
+
cron_schedules: Cron Расписания
|
49
|
+
executions: Все Исполнения
|
50
|
+
jobs: Все Задачи
|
51
|
+
live_poll: Живой Опрос
|
52
|
+
name: "GoodJob 👍"
|
53
|
+
processes: Процессы
|
data/lib/good_job/adapter.rb
CHANGED
@@ -27,7 +27,13 @@ module GoodJob
|
|
27
27
|
# @param queues [String, nil] determines which queues to execute jobs from when +execution_mode+ is set to +:async+. See {file:README.md#optimize-queues-threads-and-processes} for more details on the format of this string. You can also set this with the environment variable +GOOD_JOB_QUEUES+. Defaults to +"*"+.
|
28
28
|
# @param poll_interval [Integer, nil] sets the number of seconds between polls for jobs when +execution_mode+ is set to +:async+. You can also set this with the environment variable +GOOD_JOB_POLL_INTERVAL+. Defaults to +1+.
|
29
29
|
# @param start_async_on_initialize [Boolean] whether to start the async scheduler when the adapter is initialized.
|
30
|
-
def initialize(execution_mode: nil, queues: nil, max_threads: nil, poll_interval: nil, start_async_on_initialize:
|
30
|
+
def initialize(execution_mode: nil, queues: nil, max_threads: nil, poll_interval: nil, start_async_on_initialize: nil)
|
31
|
+
if execution_mode || queues || max_threads || poll_interval || start_async_on_initialize
|
32
|
+
ActiveSupport::Deprecation.warn(
|
33
|
+
"The GoodJob::Adapter's initialization parameters have been deprecated and will be removed in GoodJob v3. These options should be configured through GoodJob global configuration instead."
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
31
37
|
@configuration = GoodJob::Configuration.new(
|
32
38
|
{
|
33
39
|
execution_mode: execution_mode,
|
@@ -39,7 +45,7 @@ module GoodJob
|
|
39
45
|
@configuration.validate!
|
40
46
|
self.class.instances << self
|
41
47
|
|
42
|
-
start_async if start_async_on_initialize
|
48
|
+
start_async if start_async_on_initialize || GoodJob.async_ready?
|
43
49
|
end
|
44
50
|
|
45
51
|
# Enqueues the ActiveJob job to be performed.
|
data/lib/good_job/cli.rb
CHANGED
@@ -50,14 +50,14 @@ module GoodJob
|
|
50
50
|
separate isolated execution pools with semicolons and threads with colons.
|
51
51
|
|
52
52
|
DESCRIPTION
|
53
|
-
method_option :max_threads,
|
54
|
-
type: :numeric,
|
55
|
-
banner: 'COUNT',
|
56
|
-
desc: "Maximum number of threads to use for working jobs. (env var: GOOD_JOB_MAX_THREADS, default: 5)"
|
57
53
|
method_option :queues,
|
58
54
|
type: :string,
|
59
55
|
banner: "QUEUE_LIST",
|
60
|
-
desc: "Queues to work from. (env var: GOOD_JOB_QUEUES, default: *)"
|
56
|
+
desc: "Queues or queue pools to work from. (env var: GOOD_JOB_QUEUES, default: *)"
|
57
|
+
method_option :max_threads,
|
58
|
+
type: :numeric,
|
59
|
+
banner: 'COUNT',
|
60
|
+
desc: "Default number of threads per pool to use for working jobs. (env var: GOOD_JOB_MAX_THREADS, default: 5)"
|
61
61
|
method_option :poll_interval,
|
62
62
|
type: :numeric,
|
63
63
|
banner: 'SECONDS',
|
data/lib/good_job/cron_entry.rb
CHANGED
@@ -52,6 +52,10 @@ module GoodJob # :nodoc:
|
|
52
52
|
params[:args]
|
53
53
|
end
|
54
54
|
|
55
|
+
def kwargs
|
56
|
+
params[:kwargs]
|
57
|
+
end
|
58
|
+
|
55
59
|
def description
|
56
60
|
params[:description]
|
57
61
|
end
|
@@ -87,7 +91,8 @@ module GoodJob # :nodoc:
|
|
87
91
|
current_thread.cron_key = key
|
88
92
|
current_thread.cron_at = cron_at
|
89
93
|
|
90
|
-
job_class.constantize.set(set_value)
|
94
|
+
configured_job = job_class.constantize.set(set_value)
|
95
|
+
kwargs_value.present? ? configured_job.perform_later(*args_value, **kwargs_value) : configured_job.perform_later(*args_value)
|
91
96
|
end
|
92
97
|
rescue ActiveRecord::RecordNotUnique
|
93
98
|
false
|
@@ -124,6 +129,11 @@ module GoodJob # :nodoc:
|
|
124
129
|
value.respond_to?(:call) ? value.call : value
|
125
130
|
end
|
126
131
|
|
132
|
+
def kwargs_value
|
133
|
+
value = kwargs || nil
|
134
|
+
value.respond_to?(:call) ? value.call : value
|
135
|
+
end
|
136
|
+
|
127
137
|
def display_property(value)
|
128
138
|
case value
|
129
139
|
when NilClass
|
data/lib/good_job/poller.rb
CHANGED
@@ -6,13 +6,10 @@ module GoodJob # :nodoc:
|
|
6
6
|
# Pollers regularly wake up execution threads to check for new work.
|
7
7
|
#
|
8
8
|
class Poller
|
9
|
-
TIMEOUT_INTERVAL = 5
|
10
|
-
|
11
9
|
# Defaults for instance of Concurrent::TimerTask.
|
12
10
|
# The timer controls how and when sleeping threads check for new work.
|
13
11
|
DEFAULT_TIMER_OPTIONS = {
|
14
12
|
execution_interval: Configuration::DEFAULT_POLL_INTERVAL,
|
15
|
-
timeout_interval: TIMEOUT_INTERVAL,
|
16
13
|
run_now: true,
|
17
14
|
}.freeze
|
18
15
|
|
data/lib/good_job/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: good_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sheldon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -367,8 +367,8 @@ files:
|
|
367
367
|
- engine/app/assets/vendor/chartjs/chart.min.js
|
368
368
|
- engine/app/assets/vendor/rails_ujs.js
|
369
369
|
- engine/app/charts/good_job/scheduled_by_queue_chart.rb
|
370
|
+
- engine/app/controllers/good_job/application_controller.rb
|
370
371
|
- engine/app/controllers/good_job/assets_controller.rb
|
371
|
-
- engine/app/controllers/good_job/base_controller.rb
|
372
372
|
- engine/app/controllers/good_job/cron_entries_controller.rb
|
373
373
|
- engine/app/controllers/good_job/executions_controller.rb
|
374
374
|
- engine/app/controllers/good_job/jobs_controller.rb
|
@@ -385,8 +385,11 @@ files:
|
|
385
385
|
- engine/app/views/good_job/jobs/index.html.erb
|
386
386
|
- engine/app/views/good_job/jobs/show.html.erb
|
387
387
|
- engine/app/views/good_job/processes/index.html.erb
|
388
|
+
- engine/app/views/good_job/shared/_alert.erb
|
388
389
|
- engine/app/views/good_job/shared/_chart.erb
|
389
390
|
- engine/app/views/good_job/shared/_filter.erb
|
391
|
+
- engine/app/views/good_job/shared/_footer.erb
|
392
|
+
- engine/app/views/good_job/shared/_navbar.erb
|
390
393
|
- engine/app/views/good_job/shared/icons/_arrow_clockwise.html.erb
|
391
394
|
- engine/app/views/good_job/shared/icons/_check.html.erb
|
392
395
|
- engine/app/views/good_job/shared/icons/_exclamation.html.erb
|
@@ -394,7 +397,10 @@ files:
|
|
394
397
|
- engine/app/views/good_job/shared/icons/_skip_forward.html.erb
|
395
398
|
- engine/app/views/good_job/shared/icons/_stop.html.erb
|
396
399
|
- engine/app/views/good_job/shared/icons/_trash.html.erb
|
397
|
-
- engine/app/views/layouts/good_job/
|
400
|
+
- engine/app/views/layouts/good_job/application.html.erb
|
401
|
+
- engine/config/locales/en.yml
|
402
|
+
- engine/config/locales/es.yml
|
403
|
+
- engine/config/locales/ru.yaml
|
398
404
|
- engine/config/routes.rb
|
399
405
|
- engine/lib/good_job/engine.rb
|
400
406
|
- exe/good_job
|
@@ -1,96 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<title>Good Job Dashboard</title>
|
5
|
-
<meta charset="utf-8">
|
6
|
-
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
<%= csp_meta_tag %>
|
9
|
-
|
10
|
-
<%# Assets must use *_url route helpers to avoid being overriden by config.asset_host %>
|
11
|
-
<%= stylesheet_link_tag bootstrap_url(format: :css, v: GoodJob::VERSION), skip_pipeline: true %>
|
12
|
-
<%= stylesheet_link_tag style_url(format: :css, v: GoodJob::VERSION) %>
|
13
|
-
|
14
|
-
<%= javascript_include_tag bootstrap_url(format: :js, v: GoodJob::VERSION), nonce: true %>
|
15
|
-
<%= javascript_include_tag chartjs_url(format: :js, v: GoodJob::VERSION), nonce: true %>
|
16
|
-
<%= javascript_include_tag scripts_url(format: :js, v: GoodJob::VERSION), nonce: true %>
|
17
|
-
|
18
|
-
<%= javascript_include_tag rails_ujs_url(format: :js, v: GoodJob::VERSION), nonce: true %>
|
19
|
-
</head>
|
20
|
-
<body>
|
21
|
-
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
22
|
-
<div class="container-fluid">
|
23
|
-
<%= link_to "GoodJob 👍", root_path, class: 'navbar-brand mb-0 h1' %>
|
24
|
-
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
25
|
-
<span class="navbar-toggler-icon"></span>
|
26
|
-
</button>
|
27
|
-
|
28
|
-
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
29
|
-
<ul class="navbar-nav me-auto">
|
30
|
-
<li class="nav-item">
|
31
|
-
<%= link_to "All Executions", root_path, class: ["nav-link", ("active" if current_page?(root_path))] %>
|
32
|
-
</li>
|
33
|
-
<li class="nav-item">
|
34
|
-
<%= link_to "All Jobs", jobs_path, class: ["nav-link", ("active" if current_page?(jobs_path))] %>
|
35
|
-
</li>
|
36
|
-
<li class="nav-item">
|
37
|
-
<%= link_to "Cron Schedules", cron_entries_path, class: ["nav-link", ("active" if current_page?(cron_entries_path))] %>
|
38
|
-
</li>
|
39
|
-
<li class="nav-item">
|
40
|
-
<%= link_to "Processes", processes_path, class: ["nav-link", ("active" if current_page?(processes_path))] %>
|
41
|
-
</li>
|
42
|
-
<li class="nav-item">
|
43
|
-
<div class="nav-link">
|
44
|
-
<span class="badge bg-secondary">More views coming soon</span>
|
45
|
-
</div>
|
46
|
-
</li>
|
47
|
-
</ul>
|
48
|
-
<div>
|
49
|
-
<input type="checkbox" id="toggle-poll" name="toggle-poll" data-gj-action='change#togglePoll' <%= 'checked' if params[:poll].present? %>>
|
50
|
-
<label for="toggle-poll">Live Poll</label>
|
51
|
-
</div>
|
52
|
-
</div>
|
53
|
-
</div>
|
54
|
-
</nav>
|
55
|
-
|
56
|
-
<div class="container-fluid">
|
57
|
-
<div class="card border-warning text-dark my-3">
|
58
|
-
<div class="card-body">
|
59
|
-
<p class="card-text">🚧 GoodJob's dashboard is a work in progress. Please contribute ideas and code on <a href="https://github.com/bensheldon/good_job/issues" target="_blank" rel="nofollow noopener noreferrer">Github</a>.</p>
|
60
|
-
</div>
|
61
|
-
</div>
|
62
|
-
|
63
|
-
<% if notice %>
|
64
|
-
<div class="alert alert-success alert-dismissible fade show d-flex align-items-center offset-md-3 col-6" role="alert">
|
65
|
-
<%= render "good_job/shared/icons/check", class: "flex-shrink-0 me-2" %>
|
66
|
-
<div><%= notice %></div>
|
67
|
-
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
68
|
-
</div>
|
69
|
-
<% elsif alert %>
|
70
|
-
<div class="alert alert-warning alert-dismissible fade show d-flex align-items-center offset-md-3 col-6" role="alert">
|
71
|
-
<%= render "good_job/shared/icons/exclamation", class: "flex-shrink-0 me-2" %>
|
72
|
-
<div><%= alert %></div>
|
73
|
-
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
74
|
-
</div>
|
75
|
-
<% end %>
|
76
|
-
|
77
|
-
<%= yield %>
|
78
|
-
</div>
|
79
|
-
|
80
|
-
<footer class="footer mt-auto py-3 bg-light fixed-bottom" id="footer" data-gj-poll-replace>
|
81
|
-
<div class="container-fluid">
|
82
|
-
<div class="row">
|
83
|
-
<div class="col-6">
|
84
|
-
<span class="text-muted">
|
85
|
-
Last updated: <time id="page-updated-at" datetime="<%= Time.current.utc.iso8601 %>"><%= Time.current %></time>
|
86
|
-
</span>
|
87
|
-
</div>
|
88
|
-
|
89
|
-
<div class="col-6 text-end">
|
90
|
-
Remember, you're doing a Good Job too!
|
91
|
-
</div>
|
92
|
-
</div>
|
93
|
-
</div>
|
94
|
-
</footer>
|
95
|
-
</body>
|
96
|
-
</html>
|