barbeque 2.5.0 → 2.6.0
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/app/assets/javascripts/barbeque/job_definitions.coffee +8 -0
- data/app/assets/stylesheets/barbeque/job_definitions.scss +20 -0
- data/app/controllers/barbeque/api/job_executions_controller.rb +19 -2
- data/app/controllers/barbeque/job_definitions_controller.rb +11 -1
- data/app/controllers/barbeque/job_executions_controller.rb +3 -0
- data/app/controllers/barbeque/job_retries_controller.rb +3 -0
- data/app/models/barbeque/api/database_maintenance_resource.rb +11 -0
- data/app/models/barbeque/api/job_execution_resource.rb +1 -6
- data/app/models/barbeque/job_definition.rb +4 -2
- data/app/models/barbeque/job_execution.rb +17 -0
- data/app/models/barbeque/job_queue.rb +4 -7
- data/app/models/barbeque/retry_config.rb +24 -0
- data/app/views/barbeque/job_definitions/_form.html.haml +1 -0
- data/app/views/barbeque/job_definitions/_retry_configuration_field.html.haml +38 -0
- data/app/views/barbeque/job_definitions/show.html.haml +7 -0
- data/app/views/barbeque/job_executions/show.html.haml +7 -8
- data/app/views/barbeque/job_retries/show.html.haml +6 -8
- data/db/migrate/20190221050714_create_barbeque_retry_configs.rb +14 -0
- data/lib/barbeque/executor/docker.rb +8 -0
- data/lib/barbeque/executor/hako.rb +8 -0
- data/lib/barbeque/maintenance.rb +7 -0
- data/lib/barbeque/version.rb +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee2d835c84a99b3c12b30c45c6b133bd45dee8c0c90c69792e82ce7e31c4f589
|
4
|
+
data.tar.gz: a2d3a604433215188449ea6fb22dcf4f5da73ec833874d9af4abcbd2fd697132
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ba6a9de43ffda9cc5fe4dd3f5c4dde4428cc624c999831391e85a15815381957569c8b1953c07719a2444c539e1dd1d8e37cbb1bc687aefa536571df41f661e
|
7
|
+
data.tar.gz: 015b27c099386c2338bee1c9c8ebbc3ad5eea1bce3cb0ab71404808f38ee334b467d011afda2887aa00ed46b1e992cbbfcdae2e55001163ae2570da131f85530
|
@@ -8,3 +8,11 @@ jQuery ($) ->
|
|
8
8
|
else
|
9
9
|
enabledField.addClass('active')
|
10
10
|
)
|
11
|
+
|
12
|
+
$('.enable_retry_configuration').bind('change', (event) ->
|
13
|
+
enabledField = $('.retry_configuration_field')
|
14
|
+
if event.target.value == 'true'
|
15
|
+
enabledField.removeClass('active')
|
16
|
+
else
|
17
|
+
enabledField.addClass('active')
|
18
|
+
)
|
@@ -18,4 +18,24 @@
|
|
18
18
|
display: block;
|
19
19
|
}
|
20
20
|
}
|
21
|
+
|
22
|
+
.retry_configuration_wrapper label {
|
23
|
+
font-weight: normal;
|
24
|
+
}
|
25
|
+
|
26
|
+
.enable_retry_configuration {
|
27
|
+
margin: 0 2px 0 8px;
|
28
|
+
}
|
29
|
+
|
30
|
+
.retry_configuration_field {
|
31
|
+
display: none;
|
32
|
+
|
33
|
+
label {
|
34
|
+
font-weight: normal;
|
35
|
+
}
|
36
|
+
|
37
|
+
&.active {
|
38
|
+
display: block;
|
39
|
+
}
|
40
|
+
}
|
21
41
|
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'barbeque/maintenance'
|
2
|
+
|
1
3
|
class Barbeque::Api::JobExecutionsController < Barbeque::Api::ApplicationController
|
2
4
|
include Garage::RestfulActions
|
3
5
|
|
@@ -21,13 +23,20 @@ class Barbeque::Api::JobExecutionsController < Barbeque::Api::ApplicationControl
|
|
21
23
|
|
22
24
|
def require_resource
|
23
25
|
model = Barbeque::JobExecution.find_or_initialize_by(message_id: params[:message_id])
|
24
|
-
@resource = Barbeque::Api::JobExecutionResource.new(model
|
26
|
+
@resource = Barbeque::Api::JobExecutionResource.new(model)
|
27
|
+
rescue ActiveRecord::StatementInvalid, Mysql2::Error::ConnectionError => e
|
28
|
+
if Barbeque::Maintenance.database_maintenance_mode?
|
29
|
+
Barbeque::ExceptionHandler.handle_exception(e)
|
30
|
+
@resource = Barbeque::Api::DatabaseMaintenanceResource.new(e)
|
31
|
+
else
|
32
|
+
raise e
|
33
|
+
end
|
25
34
|
end
|
26
35
|
|
27
36
|
def create_resource
|
28
37
|
message_id = enqueue_message
|
29
38
|
model = Barbeque::JobExecution.new(message_id: message_id)
|
30
|
-
@resource = Barbeque::Api::JobExecutionResource.new(model
|
39
|
+
@resource = Barbeque::Api::JobExecutionResource.new(model)
|
31
40
|
end
|
32
41
|
|
33
42
|
# @return [String] id of a message queued to SQS.
|
@@ -49,4 +58,12 @@ class Barbeque::Api::JobExecutionsController < Barbeque::Api::ApplicationControl
|
|
49
58
|
nil
|
50
59
|
end
|
51
60
|
end
|
61
|
+
|
62
|
+
def respond_with_resource_options
|
63
|
+
if @resource.is_a?(Barbeque::Api::DatabaseMaintenanceResource)
|
64
|
+
super.merge(status: 503)
|
65
|
+
else
|
66
|
+
super
|
67
|
+
end
|
68
|
+
end
|
52
69
|
end
|
@@ -6,6 +6,7 @@ class Barbeque::JobDefinitionsController < Barbeque::ApplicationController
|
|
6
6
|
def show
|
7
7
|
@job_definition = Barbeque::JobDefinition.find(params[:id])
|
8
8
|
@job_executions = @job_definition.job_executions.order(id: :desc).page(params[:page])
|
9
|
+
@retry_config = @job_definition.retry_config
|
9
10
|
@status = params[:status].presence.try(&:to_i)
|
10
11
|
if @status
|
11
12
|
@job_executions = @job_executions.where(status: @status)
|
@@ -15,6 +16,7 @@ class Barbeque::JobDefinitionsController < Barbeque::ApplicationController
|
|
15
16
|
def new
|
16
17
|
@job_definition = Barbeque::JobDefinition.new
|
17
18
|
@job_definition.build_slack_notification
|
19
|
+
@job_definition.build_retry_config
|
18
20
|
if params[:job_definition]
|
19
21
|
@job_definition.assign_attributes(new_job_definition_params)
|
20
22
|
end
|
@@ -22,9 +24,12 @@ class Barbeque::JobDefinitionsController < Barbeque::ApplicationController
|
|
22
24
|
|
23
25
|
def edit
|
24
26
|
@job_definition = Barbeque::JobDefinition.find(params[:id])
|
25
|
-
|
27
|
+
unless @job_definition.slack_notification
|
26
28
|
@job_definition.build_slack_notification
|
27
29
|
end
|
30
|
+
unless @job_definition.retry_config
|
31
|
+
@job_definition.build_retry_config
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
30
35
|
def create
|
@@ -43,6 +48,7 @@ class Barbeque::JobDefinitionsController < Barbeque::ApplicationController
|
|
43
48
|
attributes = params.require(:job_definition).permit(
|
44
49
|
:description,
|
45
50
|
slack_notification_attributes: slack_notification_params,
|
51
|
+
retry_config_attributes: retry_config_params,
|
46
52
|
).merge(command: command_array)
|
47
53
|
if @job_definition.update(attributes)
|
48
54
|
redirect_to @job_definition, notice: 'Job definition was successfully updated.'
|
@@ -78,6 +84,10 @@ class Barbeque::JobDefinitionsController < Barbeque::ApplicationController
|
|
78
84
|
%i[id channel notify_success failure_notification_text _destroy]
|
79
85
|
end
|
80
86
|
|
87
|
+
def retry_config_params
|
88
|
+
%i[id retry_limit base_delay max_delay jitter _destroy]
|
89
|
+
end
|
90
|
+
|
81
91
|
def command_array
|
82
92
|
Shellwords.split(params.require(:job_definition)[:command])
|
83
93
|
end
|
@@ -10,6 +10,9 @@ class Barbeque::JobExecutionsController < Barbeque::ApplicationController
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
@job_execution = Barbeque::JobExecution.find_by!(message_id: params[:message_id])
|
13
|
+
# Return 404 when job_definition or app is deleted
|
14
|
+
@job_definition = Barbeque::JobDefinition.find(@job_execution.job_definition_id)
|
15
|
+
@app = Barbeque::App.find(@job_definition.app_id)
|
13
16
|
@log = @job_execution.execution_log
|
14
17
|
@job_retries = @job_execution.job_retries.order(id: :desc)
|
15
18
|
end
|
@@ -2,6 +2,9 @@ class Barbeque::JobRetriesController < Barbeque::ApplicationController
|
|
2
2
|
def show
|
3
3
|
@job_retry = Barbeque::JobRetry.find(params[:id])
|
4
4
|
@job_execution = @job_retry.job_execution
|
5
|
+
# Return 404 when job_definition or app is deleted
|
6
|
+
@job_definition = Barbeque::JobDefinition.find(@job_execution.job_definition_id)
|
7
|
+
@app = Barbeque::App.find(@job_definition.app_id)
|
5
8
|
|
6
9
|
if params[:job_execution_message_id] != @job_execution.message_id
|
7
10
|
redirect_to([@job_execution, @job_retry])
|
@@ -7,14 +7,9 @@ class Barbeque::Api::JobExecutionResource < Barbeque::Api::ApplicationResource
|
|
7
7
|
|
8
8
|
delegate :message_id, :status, :id, to: :model
|
9
9
|
|
10
|
-
def initialize(model, url_options)
|
11
|
-
super(model)
|
12
|
-
@url_options = url_options
|
13
|
-
end
|
14
|
-
|
15
10
|
def html_url
|
16
11
|
if model.id
|
17
|
-
Barbeque::Engine.routes.url_helpers.job_execution_url(model,
|
12
|
+
Barbeque::Engine.routes.url_helpers.job_execution_url(model, host: ENV['BARBEQUE_HOST'])
|
18
13
|
else
|
19
14
|
nil
|
20
15
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
class Barbeque::JobDefinition < Barbeque::ApplicationRecord
|
2
2
|
belongs_to :app
|
3
|
-
has_many :job_executions
|
3
|
+
has_many :job_executions
|
4
4
|
has_many :sns_subscriptions, class_name: 'SNSSubscription'
|
5
5
|
has_one :slack_notification, dependent: :destroy
|
6
|
+
has_one :retry_config, dependent: :destroy
|
6
7
|
|
7
8
|
validates :job, uniqueness: { scope: :app_id }
|
8
9
|
|
@@ -12,6 +13,7 @@ class Barbeque::JobDefinition < Barbeque::ApplicationRecord
|
|
12
13
|
serialize :command, Array
|
13
14
|
|
14
15
|
accepts_nested_attributes_for :slack_notification, allow_destroy: true
|
16
|
+
accepts_nested_attributes_for :retry_config, allow_destroy: true
|
15
17
|
|
16
18
|
DATE_HOUR_SQL = 'date_format(created_at, "%Y-%m-%d %H:00:00")'
|
17
19
|
|
@@ -26,7 +28,7 @@ class Barbeque::JobDefinition < Barbeque::ApplicationRecord
|
|
26
28
|
avg_time: avg_time,
|
27
29
|
}
|
28
30
|
end
|
29
|
-
(from.to_i ... to.to_i).step(1.hour).map do |t|
|
31
|
+
(from.to_i ... to.to_i).step(1.hour.to_i).map do |t|
|
30
32
|
time = Time.at(t)
|
31
33
|
stats[time].merge(date_hour: time)
|
32
34
|
end
|
@@ -28,4 +28,21 @@ class Barbeque::JobExecution < Barbeque::ApplicationRecord
|
|
28
28
|
def to_param
|
29
29
|
message_id
|
30
30
|
end
|
31
|
+
|
32
|
+
def retry_if_possible!
|
33
|
+
unless retryable?
|
34
|
+
return
|
35
|
+
end
|
36
|
+
retry_config = job_definition.retry_config
|
37
|
+
unless retry_config
|
38
|
+
return
|
39
|
+
end
|
40
|
+
|
41
|
+
retries = job_retries.count
|
42
|
+
if retry_config.should_retry?(retries)
|
43
|
+
delay_seconds = retry_config.delay_seconds(retries).to_i
|
44
|
+
Barbeque::MessageRetryingService.new(message_id: message_id, delay_seconds: delay_seconds).run
|
45
|
+
retried!
|
46
|
+
end
|
47
|
+
end
|
31
48
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'barbeque/maintenance'
|
2
|
+
|
1
3
|
class Barbeque::JobQueue < Barbeque::ApplicationRecord
|
2
4
|
SQS_NAME_PREFIX = ENV['BARBEQUE_SQS_NAME_PREFIX'] || 'Barbeque-'
|
3
5
|
SQS_NAME_MAX_LENGTH = 80
|
4
6
|
|
5
|
-
has_many :job_executions
|
7
|
+
has_many :job_executions
|
6
8
|
has_many :sns_subscriptions, class_name: 'SNSSubscription', dependent: :destroy
|
7
9
|
|
8
10
|
# SQS queue allows [a-zA-Z0-9_-]+ as queue name. Its maximum length is 80.
|
@@ -26,15 +28,10 @@ class Barbeque::JobQueue < Barbeque::ApplicationRecord
|
|
26
28
|
# @param name [String] queue name in Barbeque
|
27
29
|
# @return [String] queue URL of SQS
|
28
30
|
def self.queue_url_from_name(name)
|
29
|
-
if database_maintenance_mode?
|
31
|
+
if Barbeque::Maintenance.database_maintenance_mode?
|
30
32
|
"https://sqs.#{ENV.fetch('AWS_REGION')}.amazonaws.com/#{ENV.fetch('AWS_ACCOUNT_ID')}/#{SQS_NAME_PREFIX}#{name}"
|
31
33
|
else
|
32
34
|
select(:queue_url).find_by!(name: name).queue_url
|
33
35
|
end
|
34
36
|
end
|
35
|
-
|
36
|
-
def self.database_maintenance_mode?
|
37
|
-
ENV['BARBEQUE_DATABASE_MAINTENANCE'] == '1' && ENV['AWS_REGION'].present? && ENV['AWS_ACCOUNT_ID'].present?
|
38
|
-
end
|
39
|
-
private_class_method :database_maintenance_mode?
|
40
37
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Barbeque::RetryConfig < Barbeque::ApplicationRecord
|
2
|
+
belongs_to :job_definition
|
3
|
+
|
4
|
+
validates :retry_limit, numericality: { only_integer: true, greater_than: 0 }, allow_nil: true
|
5
|
+
validates :base_delay, numericality: { greater_than: 0.0 }, allow_nil: true
|
6
|
+
validates :max_delay, numericality: { greater_than: 0 }, allow_nil: true
|
7
|
+
|
8
|
+
def should_retry?(retries)
|
9
|
+
retries < retry_limit
|
10
|
+
end
|
11
|
+
|
12
|
+
# This algorithm is based on "Exponential Backoff And Jitter" article
|
13
|
+
# https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
|
14
|
+
def delay_seconds(retries)
|
15
|
+
delay = 2 ** retries * base_delay
|
16
|
+
if max_delay
|
17
|
+
delay = [delay, max_delay].min
|
18
|
+
end
|
19
|
+
if jitter
|
20
|
+
delay = Kernel.rand(0 .. delay)
|
21
|
+
end
|
22
|
+
delay
|
23
|
+
end
|
24
|
+
end
|
@@ -40,6 +40,7 @@
|
|
40
40
|
= f.text_area :description, class: 'form-control', rows: 10
|
41
41
|
|
42
42
|
= render 'slack_notification_field', job_definition: @job_definition
|
43
|
+
= render 'retry_configuration_field', job_definition: @job_definition
|
43
44
|
|
44
45
|
.form-group
|
45
46
|
= f.submit 'Save', class: 'btn btn-primary'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
= fields_for(job_definition) do |job_definition_f|
|
2
|
+
= job_definition_f.fields_for(:retry_config) do |f|
|
3
|
+
= f.hidden_field :id
|
4
|
+
|
5
|
+
.row
|
6
|
+
.col-md-8
|
7
|
+
%label Retry configuration
|
8
|
+
|
9
|
+
- retry_enabled = f.object.persisted?
|
10
|
+
.row.form-group
|
11
|
+
.col-md-8.retry_configuration_wrapper
|
12
|
+
= f.label :_destroy_true do
|
13
|
+
= f.radio_button :_destroy, true, class: 'enable_retry_configuration', checked: !retry_enabled
|
14
|
+
No
|
15
|
+
= f.label :_destroy_false do
|
16
|
+
= f.radio_button :_destroy, false, class: 'enable_retry_configuration', checked: retry_enabled
|
17
|
+
Yes
|
18
|
+
|
19
|
+
.retry_configuration_field{ class: ('active' if retry_enabled) }
|
20
|
+
.row.form-group
|
21
|
+
.col-md-4
|
22
|
+
= f.label :retry_limit
|
23
|
+
= f.number_field :retry_limit, min: 1, class: 'form-control'
|
24
|
+
|
25
|
+
.row.form-group
|
26
|
+
.col-md-4
|
27
|
+
= f.label :base_delay
|
28
|
+
= f.number_field :base_delay, min: 0.1, step: 0.1, class: 'form-control'
|
29
|
+
|
30
|
+
.row.form-group
|
31
|
+
.col-md-4
|
32
|
+
= f.label :max_delay
|
33
|
+
= f.number_field :max_delay, min: 1, class: 'form-control'
|
34
|
+
|
35
|
+
.row.form-group
|
36
|
+
.col-md-4
|
37
|
+
= f.label :jitter
|
38
|
+
= f.check_box :jitter
|
@@ -36,6 +36,13 @@
|
|
36
36
|
Yes (#{@job_definition.slack_notification.channel})
|
37
37
|
- else
|
38
38
|
No
|
39
|
+
%tr
|
40
|
+
%th Retry configuration
|
41
|
+
%td
|
42
|
+
- if @retry_config
|
43
|
+
Yes (retry_limit=#{@retry_config.retry_limit} base_delay=#{@retry_config.base_delay} max_delay=#{@retry_config.max_delay || '+inf'} jitter=#{@retry_config.jitter ? 'enabled' : 'disabled'})
|
44
|
+
- else
|
45
|
+
No
|
39
46
|
|
40
47
|
= link_to 'Edit', edit_job_definition_path(@job_definition), class: 'btn btn-primary'
|
41
48
|
= link_to 'Destroy', job_definition_path(@job_definition),
|
@@ -1,10 +1,9 @@
|
|
1
|
-
- content_for(:title, "Job execution ##{@job_execution.id} of #{@
|
1
|
+
- content_for(:title, "Job execution ##{@job_execution.id} of #{@job_definition.job} - Barbeque")
|
2
2
|
- content_for(:header) do
|
3
3
|
%ol.breadcrumb
|
4
|
-
- job_definition = @job_execution.job_definition
|
5
4
|
%li= link_to('Home', root_path)
|
6
|
-
%li= link_to(
|
7
|
-
%li= link_to(job_definition.job, job_definition_path(job_definition.id))
|
5
|
+
%li= link_to(@app.name, app_path(@app.id))
|
6
|
+
%li= link_to(@job_definition.job, job_definition_path(@job_definition.id))
|
8
7
|
%li.active #{@job_execution.message_id}
|
9
8
|
|
10
9
|
.row
|
@@ -15,12 +14,12 @@
|
|
15
14
|
.col-md-10
|
16
15
|
%h3.box-title.with_padding
|
17
16
|
\##{@job_execution.id} of
|
18
|
-
= link_to @
|
19
|
-
#{@
|
17
|
+
= link_to @job_definition do
|
18
|
+
#{@job_definition.job}
|
20
19
|
- if @job_execution.retryable?
|
21
20
|
.col-md-2
|
22
21
|
= link_to job_execution_retry_path(@job_execution), method: :post, class: 'btn btn-default btn-block pull-right',
|
23
|
-
data: { disable_with: 'retrying...', confirm: "Are you sure to retry #{@
|
22
|
+
data: { disable_with: 'retrying...', confirm: "Are you sure to retry #{@job_definition.job} ##{@job_execution.id}?" } do
|
24
23
|
Retry
|
25
24
|
|
26
25
|
.box-body
|
@@ -107,4 +106,4 @@
|
|
107
106
|
- else
|
108
107
|
Log was not found.
|
109
108
|
|
110
|
-
= link_to 'Back', job_definition_path(@
|
109
|
+
= link_to 'Back', job_definition_path(@job_definition)
|
@@ -1,12 +1,10 @@
|
|
1
|
-
- content_for(:title, "Job retry ##{@job_retry.id} of #{@
|
1
|
+
- content_for(:title, "Job retry ##{@job_retry.id} of #{@job_definition.job} - Barbeque")
|
2
2
|
- content_for(:header) do
|
3
3
|
%ol.breadcrumb
|
4
|
-
- job_execution = @job_retry.job_execution
|
5
|
-
- job_definition = job_execution.job_definition
|
6
4
|
%li= link_to('Home', root_path)
|
7
|
-
%li= link_to(
|
8
|
-
%li= link_to(job_definition.job, job_definition_path(job_definition.id))
|
9
|
-
%li= link_to(job_execution.message_id, job_execution_path(job_execution))
|
5
|
+
%li= link_to(@app.name, app_path(@app.id))
|
6
|
+
%li= link_to(@job_definition.job, job_definition_path(@job_definition.id))
|
7
|
+
%li= link_to(@job_execution.message_id, job_execution_path(@job_execution))
|
10
8
|
%li.active ##{@job_retry.id}
|
11
9
|
|
12
10
|
.row
|
@@ -17,8 +15,8 @@
|
|
17
15
|
.col-md-10
|
18
16
|
%h3.box-title.with_padding
|
19
17
|
Retry ##{@job_retry.id} of
|
20
|
-
= link_to @
|
21
|
-
#{@
|
18
|
+
= link_to @job_definition do
|
19
|
+
#{@job_definition.job}
|
22
20
|
= link_to @job_execution do
|
23
21
|
\##{@job_execution.id}
|
24
22
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateBarbequeRetryConfigs < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :barbeque_retry_configs, options: 'ENGINE=InnoDB ROW_FORMAT=dynamic DEFAULT CHARSET=utf8mb4' do |t|
|
4
|
+
t.integer :job_definition_id, null: false
|
5
|
+
t.integer :retry_limit, null: false, default: 3
|
6
|
+
t.float :base_delay, null: false, default: '0.3'
|
7
|
+
t.integer :max_delay
|
8
|
+
t.boolean :jitter, null: false, default: true
|
9
|
+
t.timestamps
|
10
|
+
|
11
|
+
t.index [:job_definition_id], unique: true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -25,6 +25,7 @@ module Barbeque
|
|
25
25
|
Barbeque::ExecutionLog.try_save_stdout_and_stderr(job_execution, stdout, stderr)
|
26
26
|
job_execution.update!(status: :failed, finished_at: Time.zone.now)
|
27
27
|
Barbeque::SlackNotifier.notify_job_execution(job_execution)
|
28
|
+
job_execution.retry_if_possible!
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
@@ -48,6 +49,7 @@ module Barbeque
|
|
48
49
|
job_execution.update!(status: :failed)
|
49
50
|
end
|
50
51
|
Barbeque::SlackNotifier.notify_job_retry(job_retry)
|
52
|
+
job_execution.retry_if_possible!
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
@@ -63,6 +65,9 @@ module Barbeque
|
|
63
65
|
stdout, stderr = get_logs(container.container_id)
|
64
66
|
Barbeque::ExecutionLog.save_stdout_and_stderr(job_execution, stdout, stderr)
|
65
67
|
Barbeque::SlackNotifier.notify_job_execution(job_execution)
|
68
|
+
if exit_code != 0
|
69
|
+
job_execution.retry_if_possible!
|
70
|
+
end
|
66
71
|
end
|
67
72
|
end
|
68
73
|
|
@@ -83,6 +88,9 @@ module Barbeque
|
|
83
88
|
stdout, stderr = get_logs(container.container_id)
|
84
89
|
Barbeque::ExecutionLog.save_stdout_and_stderr(job_retry, stdout, stderr)
|
85
90
|
Barbeque::SlackNotifier.notify_job_retry(job_retry)
|
91
|
+
if status == :failed
|
92
|
+
job_execution.retry_if_possible!
|
93
|
+
end
|
86
94
|
end
|
87
95
|
end
|
88
96
|
|
@@ -46,6 +46,7 @@ module Barbeque
|
|
46
46
|
Barbeque::ExecutionLog.try_save_stdout_and_stderr(job_execution, stdout, stderr)
|
47
47
|
job_execution.update!(status: :failed, finished_at: Time.zone.now)
|
48
48
|
Barbeque::SlackNotifier.notify_job_execution(job_execution)
|
49
|
+
job_execution.retry_if_possible!
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
@@ -71,6 +72,7 @@ module Barbeque
|
|
71
72
|
job_execution.update!(status: :failed)
|
72
73
|
end
|
73
74
|
Barbeque::SlackNotifier.notify_job_retry(job_retry)
|
75
|
+
job_execution.retry_if_possible!
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
@@ -87,6 +89,9 @@ module Barbeque
|
|
87
89
|
end
|
88
90
|
job_execution.update!(status: status, finished_at: task.stopped_at)
|
89
91
|
Barbeque::SlackNotifier.notify_job_execution(job_execution)
|
92
|
+
if status == :failed
|
93
|
+
job_execution.retry_if_possible!
|
94
|
+
end
|
90
95
|
end
|
91
96
|
end
|
92
97
|
|
@@ -107,6 +112,9 @@ module Barbeque
|
|
107
112
|
job_execution.update!(status: status)
|
108
113
|
end
|
109
114
|
Barbeque::SlackNotifier.notify_job_retry(job_retry)
|
115
|
+
if status == :failed
|
116
|
+
job_execution.retry_if_possible!
|
117
|
+
end
|
110
118
|
end
|
111
119
|
end
|
112
120
|
|
data/lib/barbeque/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barbeque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adminlte2-rails
|
@@ -268,14 +268,14 @@ dependencies:
|
|
268
268
|
requirements:
|
269
269
|
- - ">="
|
270
270
|
- !ruby/object:Gem::Version
|
271
|
-
version:
|
271
|
+
version: 5.0.0
|
272
272
|
type: :development
|
273
273
|
prerelease: false
|
274
274
|
version_requirements: !ruby/object:Gem::Requirement
|
275
275
|
requirements:
|
276
276
|
- - ">="
|
277
277
|
- !ruby/object:Gem::Version
|
278
|
-
version:
|
278
|
+
version: 5.0.0
|
279
279
|
- !ruby/object:Gem::Dependency
|
280
280
|
name: listen
|
281
281
|
requirement: !ruby/object:Gem::Requirement
|
@@ -351,6 +351,7 @@ files:
|
|
351
351
|
- app/helpers/barbeque/job_definitions_helper.rb
|
352
352
|
- app/helpers/barbeque/job_executions_helper.rb
|
353
353
|
- app/models/barbeque/api/application_resource.rb
|
354
|
+
- app/models/barbeque/api/database_maintenance_resource.rb
|
354
355
|
- app/models/barbeque/api/job_execution_resource.rb
|
355
356
|
- app/models/barbeque/api/job_retry_resource.rb
|
356
357
|
- app/models/barbeque/api/revision_lock_resource.rb
|
@@ -362,6 +363,7 @@ files:
|
|
362
363
|
- app/models/barbeque/job_execution.rb
|
363
364
|
- app/models/barbeque/job_queue.rb
|
364
365
|
- app/models/barbeque/job_retry.rb
|
366
|
+
- app/models/barbeque/retry_config.rb
|
365
367
|
- app/models/barbeque/slack_notification.rb
|
366
368
|
- app/models/barbeque/sns_subscription.rb
|
367
369
|
- app/services/barbeque/message_enqueuing_service.rb
|
@@ -373,6 +375,7 @@ files:
|
|
373
375
|
- app/views/barbeque/apps/new.html.haml
|
374
376
|
- app/views/barbeque/apps/show.html.haml
|
375
377
|
- app/views/barbeque/job_definitions/_form.html.haml
|
378
|
+
- app/views/barbeque/job_definitions/_retry_configuration_field.html.haml
|
376
379
|
- app/views/barbeque/job_definitions/_slack_notification_field.html.haml
|
377
380
|
- app/views/barbeque/job_definitions/edit.html.haml
|
378
381
|
- app/views/barbeque/job_definitions/index.html.haml
|
@@ -419,6 +422,7 @@ files:
|
|
419
422
|
- db/migrate/20170712075449_create_barbeque_ecs_hako_tasks.rb
|
420
423
|
- db/migrate/20170724025542_add_index_to_job_execution_status.rb
|
421
424
|
- db/migrate/20180411070937_add_index_to_barbeque_job_executions_created_at.rb
|
425
|
+
- db/migrate/20190221050714_create_barbeque_retry_configs.rb
|
422
426
|
- lib/barbeque.rb
|
423
427
|
- lib/barbeque/config.rb
|
424
428
|
- lib/barbeque/docker_image.rb
|
@@ -430,6 +434,7 @@ files:
|
|
430
434
|
- lib/barbeque/executor/docker.rb
|
431
435
|
- lib/barbeque/executor/hako.rb
|
432
436
|
- lib/barbeque/hako_s3_client.rb
|
437
|
+
- lib/barbeque/maintenance.rb
|
433
438
|
- lib/barbeque/message.rb
|
434
439
|
- lib/barbeque/message/base.rb
|
435
440
|
- lib/barbeque/message/invalid_message.rb
|
@@ -468,8 +473,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
468
473
|
- !ruby/object:Gem::Version
|
469
474
|
version: '0'
|
470
475
|
requirements: []
|
471
|
-
|
472
|
-
rubygems_version: 2.7.6
|
476
|
+
rubygems_version: 3.0.1
|
473
477
|
signing_key:
|
474
478
|
specification_version: 4
|
475
479
|
summary: Job queue system to run job with Docker
|