good_job 4.1.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +71 -0
- data/README.md +10 -10
- data/app/charts/good_job/performance_index_chart.rb +1 -1
- data/app/charts/good_job/performance_show_chart.rb +1 -1
- data/app/controllers/good_job/application_controller.rb +1 -1
- data/app/controllers/good_job/batches_controller.rb +6 -0
- data/app/controllers/good_job/frontends_controller.rb +6 -2
- data/app/controllers/good_job/performance_controller.rb +1 -1
- data/app/frontend/good_job/icons.svg +79 -0
- data/app/frontend/good_job/style.css +5 -0
- data/app/helpers/good_job/icons_helper.rb +8 -5
- data/app/models/concerns/good_job/advisory_lockable.rb +17 -7
- data/app/models/concerns/good_job/error_events.rb +2 -2
- data/app/models/concerns/good_job/reportable.rb +8 -12
- data/app/models/good_job/batch.rb +31 -9
- data/app/models/good_job/batch_record.rb +19 -20
- data/app/models/good_job/discrete_execution.rb +6 -59
- data/app/models/good_job/execution.rb +59 -4
- data/app/models/good_job/execution_result.rb +6 -6
- data/app/models/good_job/job.rb +543 -12
- data/app/models/good_job/process.rb +14 -3
- data/app/views/good_job/batches/_jobs.erb +1 -1
- data/app/views/good_job/batches/_table.erb +7 -1
- data/app/views/good_job/batches/show.html.erb +8 -0
- data/app/views/good_job/jobs/index.html.erb +1 -1
- data/app/views/layouts/good_job/application.html.erb +7 -7
- data/config/brakeman.ignore +75 -0
- data/config/locales/de.yml +54 -49
- data/config/locales/en.yml +5 -0
- data/config/locales/es.yml +19 -14
- data/config/locales/fr.yml +5 -0
- data/config/locales/it.yml +5 -0
- data/config/locales/ja.yml +10 -5
- data/config/locales/ko.yml +9 -4
- data/config/locales/nl.yml +5 -0
- data/config/locales/pt-BR.yml +5 -0
- data/config/locales/ru.yml +5 -0
- data/config/locales/tr.yml +5 -0
- data/config/locales/uk.yml +6 -1
- data/config/routes.rb +8 -4
- data/lib/good_job/active_job_extensions/concurrency.rb +109 -98
- data/lib/good_job/adapter/inline_buffer.rb +73 -0
- data/lib/good_job/adapter.rb +59 -53
- data/lib/good_job/capsule_tracker.rb +2 -2
- data/lib/good_job/configuration.rb +13 -12
- data/lib/good_job/cron_manager.rb +1 -3
- data/lib/good_job/current_thread.rb +4 -4
- data/lib/good_job/notifier/process_heartbeat.rb +3 -2
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +6 -5
- metadata +6 -20
- data/app/models/good_job/base_execution.rb +0 -605
- data/app/views/good_job/shared/icons/_arrow_clockwise.html.erb +0 -5
- data/app/views/good_job/shared/icons/_check.html.erb +0 -5
- data/app/views/good_job/shared/icons/_circle_half.html.erb +0 -4
- data/app/views/good_job/shared/icons/_clock.html.erb +0 -5
- data/app/views/good_job/shared/icons/_dash_circle.html.erb +0 -5
- data/app/views/good_job/shared/icons/_dots.html.erb +0 -3
- data/app/views/good_job/shared/icons/_eject.html.erb +0 -4
- data/app/views/good_job/shared/icons/_exclamation.html.erb +0 -5
- data/app/views/good_job/shared/icons/_globe.html.erb +0 -3
- data/app/views/good_job/shared/icons/_info.html.erb +0 -4
- data/app/views/good_job/shared/icons/_moon_stars_fill.html.erb +0 -5
- data/app/views/good_job/shared/icons/_pause.html.erb +0 -4
- data/app/views/good_job/shared/icons/_play.html.erb +0 -4
- data/app/views/good_job/shared/icons/_skip_forward.html.erb +0 -4
- data/app/views/good_job/shared/icons/_stop.html.erb +0 -4
- data/app/views/good_job/shared/icons/_sun_fill.html.erb +0 -4
@@ -1,63 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module GoodJob
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
self.table_name = 'good_job_executions'
|
8
|
-
self.implicit_order_column = 'created_at'
|
9
|
-
|
10
|
-
belongs_to :job, class_name: 'GoodJob::Job', foreign_key: 'active_job_id', primary_key: 'active_job_id', inverse_of: :discrete_executions, optional: true
|
11
|
-
|
12
|
-
scope :finished, -> { where.not(finished_at: nil) }
|
13
|
-
|
14
|
-
alias_attribute :performed_at, :created_at
|
15
|
-
|
16
|
-
# TODO: Remove when support for Rails 6.1 is dropped
|
17
|
-
attribute :duration, :interval if ActiveJob.version.canonical_segments.take(2) == [6, 1]
|
18
|
-
|
19
|
-
def number
|
20
|
-
serialized_params.fetch('executions', 0) + 1
|
21
|
-
end
|
22
|
-
|
23
|
-
# Time between when this job was expected to run and when it started running
|
24
|
-
def queue_latency
|
25
|
-
created_at - scheduled_at
|
26
|
-
end
|
27
|
-
|
28
|
-
# Monotonic time between when this job started and finished
|
29
|
-
def runtime_latency
|
30
|
-
duration
|
31
|
-
end
|
32
|
-
|
33
|
-
def last_status_at
|
34
|
-
finished_at || created_at
|
35
|
-
end
|
36
|
-
|
37
|
-
def status
|
38
|
-
if finished_at.present?
|
39
|
-
if error.present? && job.finished_at.present?
|
40
|
-
:discarded
|
41
|
-
elsif error.present?
|
42
|
-
:retried
|
43
|
-
else
|
44
|
-
:succeeded
|
45
|
-
end
|
46
|
-
else
|
47
|
-
:running
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def display_serialized_params
|
52
|
-
serialized_params.merge({
|
53
|
-
_good_job_execution: attributes.except('serialized_params'),
|
54
|
-
})
|
55
|
-
end
|
56
|
-
|
57
|
-
def filtered_error_backtrace
|
58
|
-
Rails.backtrace_cleaner.clean(error_backtrace || [])
|
59
|
-
end
|
3
|
+
module GoodJob
|
4
|
+
# Deprecated, use +Execution+ instead.
|
5
|
+
class DiscreteExecution < Execution
|
60
6
|
end
|
61
|
-
end
|
62
7
|
|
63
|
-
ActiveSupport
|
8
|
+
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
9
|
+
deprecate_constant :DiscreteExecution, 'Execution', deprecator: GoodJob.deprecator
|
10
|
+
end
|
@@ -1,8 +1,63 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
module GoodJob
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module GoodJob # :nodoc:
|
4
|
+
class Execution < BaseRecord
|
5
|
+
include ErrorEvents
|
6
|
+
|
7
|
+
self.table_name = 'good_job_executions'
|
8
|
+
self.implicit_order_column = 'created_at'
|
9
|
+
|
10
|
+
belongs_to :job, class_name: 'GoodJob::Job', foreign_key: 'active_job_id', primary_key: 'id', inverse_of: :executions, optional: true
|
11
|
+
|
12
|
+
scope :finished, -> { where.not(finished_at: nil) }
|
13
|
+
|
14
|
+
alias_attribute :performed_at, :created_at
|
15
|
+
|
16
|
+
# TODO: Remove when support for Rails 6.1 is dropped
|
17
|
+
attribute :duration, :interval if ActiveJob.version.canonical_segments.take(2) == [6, 1]
|
18
|
+
|
19
|
+
def number
|
20
|
+
serialized_params.fetch('executions', 0) + 1
|
21
|
+
end
|
22
|
+
|
23
|
+
# Time between when this job was expected to run and when it started running
|
24
|
+
def queue_latency
|
25
|
+
created_at - scheduled_at
|
26
|
+
end
|
27
|
+
|
28
|
+
# Monotonic time between when this job started and finished
|
29
|
+
def runtime_latency
|
30
|
+
duration
|
31
|
+
end
|
32
|
+
|
33
|
+
def last_status_at
|
34
|
+
finished_at || created_at
|
35
|
+
end
|
36
|
+
|
37
|
+
def status
|
38
|
+
if finished_at.present?
|
39
|
+
if error.present? && job.finished_at.present?
|
40
|
+
:discarded
|
41
|
+
elsif error.present?
|
42
|
+
:retried
|
43
|
+
else
|
44
|
+
:succeeded
|
45
|
+
end
|
46
|
+
else
|
47
|
+
:running
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def display_serialized_params
|
52
|
+
serialized_params.merge({
|
53
|
+
_good_job_execution: attributes.except('serialized_params'),
|
54
|
+
})
|
55
|
+
end
|
56
|
+
|
57
|
+
def filtered_error_backtrace
|
58
|
+
Rails.backtrace_cleaner.clean(error_backtrace || [])
|
59
|
+
end
|
7
60
|
end
|
8
61
|
end
|
62
|
+
|
63
|
+
ActiveSupport.run_load_hooks(:good_job_execution, GoodJob::Execution)
|
@@ -13,22 +13,22 @@ module GoodJob
|
|
13
13
|
attr_reader :error_event
|
14
14
|
# @return [Boolean, nil]
|
15
15
|
attr_reader :unexecutable
|
16
|
-
# @return [GoodJob::
|
17
|
-
attr_reader :
|
16
|
+
# @return [GoodJob::Job, nil]
|
17
|
+
attr_reader :retried_job
|
18
18
|
|
19
19
|
# @param value [Object, nil]
|
20
20
|
# @param handled_error [Exception, nil]
|
21
21
|
# @param unhandled_error [Exception, nil]
|
22
22
|
# @param error_event [String, nil]
|
23
23
|
# @param unexecutable [Boolean, nil]
|
24
|
-
# @param
|
25
|
-
def initialize(value:, handled_error: nil, unhandled_error: nil, error_event: nil, unexecutable: nil,
|
24
|
+
# @param retried_job [GoodJob::Job, nil]
|
25
|
+
def initialize(value:, handled_error: nil, unhandled_error: nil, error_event: nil, unexecutable: nil, retried_job: nil)
|
26
26
|
@value = value
|
27
27
|
@handled_error = handled_error
|
28
28
|
@unhandled_error = unhandled_error
|
29
29
|
@error_event = error_event
|
30
30
|
@unexecutable = unexecutable
|
31
|
-
@
|
31
|
+
@retried_job = retried_job
|
32
32
|
end
|
33
33
|
|
34
34
|
# @return [Boolean]
|
@@ -38,7 +38,7 @@ module GoodJob
|
|
38
38
|
|
39
39
|
# @return [Boolean]
|
40
40
|
def retried?
|
41
|
-
|
41
|
+
retried_job.present?
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|