barbeque 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/barbeque/apps/edit.html.haml +7 -1
  3. data/app/views/barbeque/apps/index.html.haml +5 -0
  4. data/app/views/barbeque/apps/new.html.haml +5 -0
  5. data/app/views/barbeque/apps/show.html.haml +6 -0
  6. data/app/views/barbeque/job_definitions/edit.html.haml +7 -0
  7. data/app/views/barbeque/job_definitions/index.html.haml +5 -0
  8. data/app/views/barbeque/job_definitions/new.html.haml +7 -0
  9. data/app/views/barbeque/job_definitions/show.html.haml +7 -0
  10. data/app/views/barbeque/job_definitions/stats.html.haml +7 -0
  11. data/app/views/barbeque/job_executions/show.html.haml +9 -0
  12. data/app/views/barbeque/job_queues/edit.html.haml +8 -1
  13. data/app/views/barbeque/job_queues/index.html.haml +6 -0
  14. data/app/views/barbeque/job_queues/new.html.haml +6 -0
  15. data/app/views/barbeque/job_queues/show.html.haml +7 -0
  16. data/app/views/barbeque/job_retries/show.html.haml +11 -0
  17. data/app/views/barbeque/monitors/index.html.haml +6 -0
  18. data/app/views/barbeque/sns_subscriptions/edit.html.haml +7 -0
  19. data/app/views/barbeque/sns_subscriptions/index.html.haml +6 -0
  20. data/app/views/barbeque/sns_subscriptions/new.html.haml +6 -0
  21. data/app/views/barbeque/sns_subscriptions/show.html.haml +7 -0
  22. data/app/views/layouts/barbeque/application.html.haml +1 -1
  23. data/app/views/layouts/barbeque/sns_subscriptions.html.haml +6 -0
  24. data/lib/barbeque/execution_log.rb +10 -1
  25. data/lib/barbeque/executor/docker.rb +3 -2
  26. data/lib/barbeque/executor/hako.rb +5 -4
  27. data/lib/barbeque/message_handler/job_execution.rb +11 -6
  28. data/lib/barbeque/version.rb +1 -1
  29. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e40cf0144aba9f752b9dcbe2bd9f7cc44c7c67a5
4
- data.tar.gz: e62cc25ffe4149198edc0bf1112ec3a7393da534
3
+ metadata.gz: 0a2d49fbe13b55d7fbcc1b00150bc61f2345136c
4
+ data.tar.gz: 6af129b187c7367753e9474bfe484bcedca466a4
5
5
  SHA512:
6
- metadata.gz: 661b4b161c357fe7b2ebc16923c6c643e597dbe060d6395fad78af6981c0f66fa12c84581ac795833985b2c54f13c5e038f088c36719d62ebdc710035fd02441
7
- data.tar.gz: d57d756c680dffd8792d5e53b4bf70a0ff724e92a6da7dc0160b6204ae01c33e51fc3d8c3704b10b8af4f3e80f588e7f9ca00d95edc5f44a825cc653f8e36340
6
+ metadata.gz: a2b3986cc9434d160b9e5b7efdb3b74513f522eaacd8caf07a4bb641b4d6f2807c09d1d5255787c1a730a9aa3639a92ce0ce26dd011587a7365d0f7d322ed820
7
+ data.tar.gz: 1f6cf3e3279464919f88782a61eda99c4c464dc743aecc37325226ae92879aad56d4d8d00d69a67d121206f4725fda16170e7268abb59ff5cea2d43463c5f74b
@@ -1,3 +1,9 @@
1
+ - content_for(:title, "Edit #{@app.name} - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to(@app.name, app_path(@app.id))
6
+
1
7
  = render 'form'
2
8
 
3
- = link_to 'Back', root_path
9
+ = link_to 'Back', app_path(@app.id)
@@ -1,3 +1,8 @@
1
+ - content_for(:title, 'Barbeque')
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li.active Home
5
+
1
6
  .box.box-primary
2
7
  .box-header
3
8
  %h3.box-title.with_padding
@@ -1,3 +1,8 @@
1
+ - content_for(:title, 'New application - Barbeque')
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+
1
6
  = render 'form'
2
7
 
3
8
  = link_to 'Back', root_path
@@ -1,3 +1,9 @@
1
+ - content_for(:title, "#{@app.name} - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li.active #{@app.name}
6
+
1
7
  .box.box-primary
2
8
  .box-header
3
9
  %h3.box-title.with_padding
@@ -1,3 +1,10 @@
1
+ - content_for(:title, "Edit job definition #{@job_definition.job} - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to(@job_definition.app.name, app_path(@job_definition.app.id))
6
+ %li= link_to(@job_definition.job, job_definition_path(@job_definition.id))
7
+
1
8
  = render 'form'
2
9
 
3
10
  = link_to 'Back', job_definition_path(@job_definition)
@@ -1,3 +1,8 @@
1
+ - content_for(:title, 'Job definitions - Barbeque')
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+
1
6
  .box.box-primary
2
7
  .box-header
3
8
  %h3.box-title.with_padding
@@ -1,3 +1,10 @@
1
+ - content_for(:title, 'New job definition - Barbeque')
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ - if @job_definition.app
6
+ %li= link_to(@job_definition.app.name, app_path(@job_definition.app.id))
7
+
1
8
  = render 'form'
2
9
 
3
10
  = link_to 'Back', job_definitions_path
@@ -1,3 +1,10 @@
1
+ - content_for(:title, "#{@job_definition.job} - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to(@job_definition.app.name, app_path(@job_definition.app.id))
6
+ %li.active #{@job_definition.job}
7
+
1
8
  .row
2
9
  .col-sm-7
3
10
  .box.box-primary
@@ -1,3 +1,10 @@
1
+ - content_for(:title, "#{@job_definition.job} statistics - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to(@job_definition.app.name, app_path(@job_definition.app.id))
6
+ %li= link_to(@job_definition.job, job_definition_path(@job_definition.id))
7
+
1
8
  .row
2
9
  .col-sm-12
3
10
  .box.box-primary
@@ -1,3 +1,12 @@
1
+ - content_for(:title, "Job execution ##{@job_execution.id} of #{@job_execution.job_definition.job} - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ - job_definition = @job_execution.job_definition
5
+ %li= link_to('Home', root_path)
6
+ %li= link_to(job_definition.app.name, app_path(job_definition.app.id))
7
+ %li= link_to(job_definition.job, job_definition_path(job_definition.id))
8
+ %li.active ##{@job_execution.id}
9
+
1
10
  .row
2
11
  .col-sm-7
3
12
  .box.box-primary
@@ -1,3 +1,10 @@
1
+ - content_for(:title, "Edit #{@job_queue.name} job queue - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to('Job queues', job_queues_path)
6
+ %li= link_to(@job_queue.name, job_queue_path(@job_queue.id))
7
+
1
8
  = render 'form'
2
9
 
3
- = link_to 'Back', job_queues_path
10
+ = link_to 'Back', job_queue_path(@job_queue.id)
@@ -1,3 +1,9 @@
1
+ - content_for(:title, 'Job queues - Barbeque')
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li.active Job queues
6
+
1
7
  .box.box-primary
2
8
  .box-header
3
9
  %h3.box-title.with_padding
@@ -1,3 +1,9 @@
1
+ - content_for(:title, 'New job queue - Barbeque')
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to('Job queues', job_queues_path)
6
+
1
7
  = render 'form'
2
8
 
3
9
  = link_to 'Back', job_queues_path
@@ -1,3 +1,10 @@
1
+ - content_for(:title, "#{@job_queue.name} job queue - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to('Job queues', job_queues_path)
6
+ %li.active= @job_queue.name
7
+
1
8
  .box.box-primary
2
9
  .box-header
3
10
  %h3.box-title.with_padding
@@ -1,3 +1,14 @@
1
+ - content_for(:title, "Job retry ##{@job_retry.id} of #{@job_retry.job_execution.job_definition.job} - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ - job_execution = @job_retry.job_execution
5
+ - job_definition = job_execution.job_definition
6
+ %li= link_to('Home', root_path)
7
+ %li= link_to(job_definition.app.name, app_path(job_definition.app.id))
8
+ %li= link_to(job_definition.job, job_definition_path(job_definition.id))
9
+ %li= link_to("##{job_execution.id}", job_execution_path(job_execution.id))
10
+ %li.active ##{@job_retry.id}
11
+
1
12
  .row
2
13
  .col-sm-12
3
14
  .box.box-primary
@@ -1,3 +1,9 @@
1
+ - content_for(:title, 'Monitors - Barbeque')
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li.active Monitors
6
+
1
7
  .row
2
8
  .col-sm-12
3
9
  .box.box-primary
@@ -1,3 +1,10 @@
1
+ - content_for(:title, "Edit SNS subscription between #{@sns_subscription.topic_arn} and #{@sns_subscription.job_queue.name} - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to('SNS subscriptions', sns_subscriptions_path)
6
+ %li= link_to(@sns_subscription.topic_arn, sns_subscription_path(@sns_subscription.id))
7
+
1
8
  = render 'form'
2
9
 
3
10
  = link_to 'Back', sns_subscription_path(@sns_subscription)
@@ -1,3 +1,9 @@
1
+ - content_for(:title, 'SNS subscriptions - Barbeque')
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li.active SNS subscriptions
6
+
1
7
  .box.box-primary
2
8
  .box-header
3
9
  %h3.box-title.with_padding
@@ -1,3 +1,9 @@
1
+ - content_for(:title, 'New SNS subscription - Barbeque')
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to('SNS subscriptions', sns_subscriptions_path)
6
+
1
7
  = render 'form'
2
8
 
3
9
  = link_to 'Back', sns_subscriptions_path
@@ -1,3 +1,10 @@
1
+ - content_for(:title, "SNS subscription between #{@sns_subscription.topic_arn} and #{@sns_subscription.job_queue.name} - Barbeque")
2
+ - content_for(:header) do
3
+ %ol.breadcrumb
4
+ %li= link_to('Home', root_path)
5
+ %li= link_to('SNS subscriptions', sns_subscriptions_path)
6
+ %li.active #{@sns_subscription.topic_arn}
7
+
1
8
  .row
2
9
  .col-sm-7
3
10
  .box.box-primary
@@ -3,7 +3,7 @@
3
3
  %head
4
4
  %meta{ content: 'text/html; charset=UTF-8', 'http-equiv': 'Content-Type' }
5
5
  %meta{ charset: 'UTF-8' }
6
- %title Barbeque
6
+ %title= content_for(:title)
7
7
  %meta{ content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no', name: 'viewport' }
8
8
  -# FIXME: Don't rely on others' CDN
9
9
  %link{ href: 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', rel: 'stylesheet', type: 'text/css' }
@@ -0,0 +1,6 @@
1
+ - content_for(:header) do
2
+ %h1
3
+ %i.fa.fa-calendar-plus-o
4
+ SNS Subscriptions
5
+
6
+ = render template: 'layouts/barbeque/application'
@@ -7,7 +7,7 @@ module Barbeque
7
7
  DEFAULT_S3_BUCKET_NAME = 'barbeque'
8
8
 
9
9
  class << self
10
- delegate :save_message, :save_stdout_and_stderr, :load, to: :new
10
+ delegate :save_message, :save_stdout_and_stderr, :try_save_stdout_and_stderr, :load, to: :new
11
11
 
12
12
  def s3_client
13
13
  @s3_client ||= Aws::S3::Client.new
@@ -28,6 +28,15 @@ module Barbeque
28
28
  put(execution, 'stderr.txt', stderr)
29
29
  end
30
30
 
31
+ # @param [Barbeque::JobExecution,Barbeque::JobRetry] execution
32
+ # @param [String] stdout
33
+ # @param [String] stderr
34
+ def try_save_stdout_and_stderr(execution, stdout, stderr)
35
+ save_stdout_and_stderr(execution, stdout, stderr)
36
+ rescue Aws::S3::Errors::ServiceError => e
37
+ ExceptionHandler.handle_exception(e)
38
+ end
39
+
31
40
  # @param [Barbeque::JobExecution,Barbeque::JobRetry] execution
32
41
  # @return [Hash] log
33
42
  def load(execution:)
@@ -1,4 +1,5 @@
1
1
  require 'barbeque/docker_image'
2
+ require 'barbeque/execution_log'
2
3
  require 'barbeque/slack_notifier'
3
4
  require 'open3'
4
5
 
@@ -21,7 +22,7 @@ module Barbeque
21
22
  Barbeque::DockerContainer.create!(message_id: job_execution.message_id, container_id: stdout.chomp)
22
23
  job_execution.update!(status: :running)
23
24
  else
24
- Barbeque::ExecutionLog.save_stdout_and_stderr(job_execution, stdout, stderr)
25
+ Barbeque::ExecutionLog.try_save_stdout_and_stderr(job_execution, stdout, stderr)
25
26
  job_execution.update!(status: :failed, finished_at: Time.zone.now)
26
27
  Barbeque::SlackNotifier.notify_job_execution(job_execution)
27
28
  end
@@ -41,7 +42,7 @@ module Barbeque
41
42
  job_retry.update!(status: :running)
42
43
  end
43
44
  else
44
- Barbeque::ExecutionLog.save_stdout_and_stderr(job_retry, stdout, stderr)
45
+ Barbeque::ExecutionLog.try_save_stdout_and_stderr(job_retry, stdout, stderr)
45
46
  Barbeque::ApplicationRecord.transaction do
46
47
  job_retry.update!(status: :failed, finished_at: Time.zone.now)
47
48
  job_execution.update!(status: :failed)
@@ -1,4 +1,5 @@
1
1
  require 'barbeque/docker_image'
2
+ require 'barbeque/execution_log'
2
3
  require 'barbeque/slack_notifier'
3
4
  require 'open3'
4
5
  require 'uri'
@@ -31,10 +32,10 @@ module Barbeque
31
32
  if status.success?
32
33
  cluster, task_arn = extract_task_info(stdout)
33
34
  Barbeque::EcsHakoTask.create!(message_id: job_execution.message_id, cluster: cluster, task_arn: task_arn)
34
- Barbeque::ExecutionLog.save_stdout_and_stderr(job_execution, stdout, stderr)
35
+ Barbeque::ExecutionLog.try_save_stdout_and_stderr(job_execution, stdout, stderr)
35
36
  job_execution.update!(status: :running)
36
37
  else
37
- Barbeque::ExecutionLog.save_stdout_and_stderr(job_execution, stdout, stderr)
38
+ Barbeque::ExecutionLog.try_save_stdout_and_stderr(job_execution, stdout, stderr)
38
39
  job_execution.update!(status: :failed, finished_at: Time.zone.now)
39
40
  Barbeque::SlackNotifier.notify_job_execution(job_execution)
40
41
  end
@@ -50,13 +51,13 @@ module Barbeque
50
51
  if status.success?
51
52
  cluster, task_arn = extract_task_info(stdout)
52
53
  Barbeque::EcsHakoTask.create!(message_id: job_retry.message_id, cluster: cluster, task_arn: task_arn)
53
- Barbeque::ExecutionLog.save_stdout_and_stderr(job_retry, stdout, stderr)
54
+ Barbeque::ExecutionLog.try_save_stdout_and_stderr(job_retry, stdout, stderr)
54
55
  Barbeque::ApplicationRecord.transaction do
55
56
  job_execution.update!(status: :retried)
56
57
  job_retry.update!(status: :running)
57
58
  end
58
59
  else
59
- Barbeque::ExecutionLog.save_stdout_and_stderr(job_retry, stdout, stderr)
60
+ Barbeque::ExecutionLog.try_save_stdout_and_stderr(job_retry, stdout, stderr)
60
61
  Barbeque::ApplicationRecord.transaction do
61
62
  job_retry.update!(status: :failed, finished_at: Time.zone.now)
62
63
  job_execution.update!(status: :failed)
@@ -13,12 +13,7 @@ module Barbeque
13
13
  end
14
14
 
15
15
  def run
16
- begin
17
- job_execution = Barbeque::JobExecution.create(message_id: @message.id, job_definition: job_definition, job_queue: @message_queue.job_queue)
18
- rescue ActiveRecord::RecordNotUnique => e
19
- raise DuplicatedExecution.new(e.message)
20
- end
21
- Barbeque::ExecutionLog.save_message(job_execution, @message)
16
+ job_execution = create_job_execution
22
17
  @message_queue.delete_message(@message)
23
18
 
24
19
  begin
@@ -49,6 +44,16 @@ module Barbeque
49
44
  barbeque_apps: { name: @message.application },
50
45
  )
51
46
  end
47
+
48
+ def create_job_execution
49
+ Barbeque::JobExecution.transaction do
50
+ Barbeque::JobExecution.create(message_id: @message.id, job_definition: job_definition, job_queue: @message_queue.job_queue).tap do |job_execution|
51
+ Barbeque::ExecutionLog.save_message(job_execution, @message)
52
+ end
53
+ end
54
+ rescue ActiveRecord::RecordNotUnique => e
55
+ raise DuplicatedExecution.new(e.message)
56
+ end
52
57
  end
53
58
  end
54
59
  end
@@ -1,3 +1,3 @@
1
1
  module Barbeque
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
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: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-26 00:00:00.000000000 Z
11
+ date: 2017-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adminlte2-rails
@@ -346,6 +346,7 @@ files:
346
346
  - app/views/layouts/barbeque/job_queues.html.haml
347
347
  - app/views/layouts/barbeque/job_retries.html.haml
348
348
  - app/views/layouts/barbeque/monitors.html.haml
349
+ - app/views/layouts/barbeque/sns_subscriptions.html.haml
349
350
  - config/initializers/garage.rb
350
351
  - config/routes.rb
351
352
  - db/migrate/20160217020910_create_job_queues.rb