barbeque 0.0.17 → 0.0.18
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b74360e927b8b8f90a69596aea81cc2f9633d8d
|
4
|
+
data.tar.gz: e424b26777290d0b8166cec62a0a02e79127516d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5714b9963c40cd056785383f48c49b9bde795d527a949d5c5141840d7cf01357af70abb40d73d59362afb87a0e83affaf6021fe5c8abe3688d2319f8620a5efe
|
7
|
+
data.tar.gz: e810b629aa2dbcb0331be1f9b0d3b0a2525f5b1abc911c03ca33a18bca9643823181a2dc255efe3edff9c40f5fd2dc5a4a7b5237dd84b8e5eb9a3275d5564aab
|
@@ -3,6 +3,10 @@ require 'aws-sdk'
|
|
3
3
|
class Barbeque::MessageEnqueuingService
|
4
4
|
DEFAULT_QUEUE = ENV['BARBEQUE_DEFAULT_QUEUE'] || 'default'
|
5
5
|
|
6
|
+
def self.sqs_client
|
7
|
+
@sqs_client ||= Aws::SQS::Client.new
|
8
|
+
end
|
9
|
+
|
6
10
|
# @param [String] application
|
7
11
|
# @param [String] job
|
8
12
|
# @param [Object] message
|
@@ -17,7 +21,7 @@ class Barbeque::MessageEnqueuingService
|
|
17
21
|
# @return [String] message_id
|
18
22
|
def run
|
19
23
|
queue = Barbeque::JobQueue.find_by!(name: @queue)
|
20
|
-
response =
|
24
|
+
response = Barbeque::MessageEnqueuingService.sqs_client.send_message(
|
21
25
|
queue_url: queue.queue_url,
|
22
26
|
message_body: build_message.to_json,
|
23
27
|
)
|
@@ -34,8 +38,4 @@ class Barbeque::MessageEnqueuingService
|
|
34
38
|
'Message' => @message,
|
35
39
|
}
|
36
40
|
end
|
37
|
-
|
38
|
-
def client
|
39
|
-
@client ||= Aws::SQS::Client.new
|
40
|
-
end
|
41
41
|
end
|
@@ -3,6 +3,10 @@ require 'aws-sdk'
|
|
3
3
|
class Barbeque::MessageRetryingService
|
4
4
|
DEFAULT_DELAY_SECONDS = 0
|
5
5
|
|
6
|
+
def self.sqs_client
|
7
|
+
@sqs_client ||= Aws::SQS::Client.new
|
8
|
+
end
|
9
|
+
|
6
10
|
def initialize(message_id:, delay_seconds: nil)
|
7
11
|
@message_id = message_id
|
8
12
|
@delay_seconds = delay_seconds || DEFAULT_DELAY_SECONDS
|
@@ -10,7 +14,7 @@ class Barbeque::MessageRetryingService
|
|
10
14
|
|
11
15
|
def run
|
12
16
|
execution = Barbeque::JobExecution.find_by!(message_id: @message_id)
|
13
|
-
|
17
|
+
Barbeque::MessageRetryingService.sqs_client.send_message(
|
14
18
|
queue_url: execution.job_queue.queue_url,
|
15
19
|
message_body: build_message.to_json,
|
16
20
|
delay_seconds: @delay_seconds,
|
@@ -25,8 +29,4 @@ class Barbeque::MessageRetryingService
|
|
25
29
|
'RetryMessageId' => @message_id,
|
26
30
|
}
|
27
31
|
end
|
28
|
-
|
29
|
-
def client
|
30
|
-
@client ||= Aws::SQS::Client.new
|
31
|
-
end
|
32
32
|
end
|
@@ -8,12 +8,16 @@ module Barbeque
|
|
8
8
|
|
9
9
|
class << self
|
10
10
|
delegate :save, :load, to: :new
|
11
|
+
|
12
|
+
def s3_client
|
13
|
+
@s3_client ||= Aws::S3::Client.new
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
# @param [Barbeque::JobExecution,Barbeque::JobRetry] execution
|
14
18
|
# @param [Hash] log
|
15
19
|
def save(execution:, log:)
|
16
|
-
|
20
|
+
ExecutionLog.s3_client.put_object(
|
17
21
|
bucket: s3_bucket_name,
|
18
22
|
key: s3_key_for(execution: execution),
|
19
23
|
body: log.to_json,
|
@@ -25,7 +29,7 @@ module Barbeque
|
|
25
29
|
def load(execution:)
|
26
30
|
return {} if execution.pending?
|
27
31
|
|
28
|
-
s3_object =
|
32
|
+
s3_object = ExecutionLog.s3_client.get_object(
|
29
33
|
bucket: s3_bucket_name,
|
30
34
|
key: s3_key_for(execution: execution),
|
31
35
|
)
|
@@ -43,9 +47,5 @@ module Barbeque
|
|
43
47
|
def s3_key_for(execution:)
|
44
48
|
File.join(execution.app.name, execution.job_definition.job, execution.message_id)
|
45
49
|
end
|
46
|
-
|
47
|
-
def s3
|
48
|
-
@s3 ||= Aws::S3::Client.new
|
49
|
-
end
|
50
50
|
end
|
51
51
|
end
|
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: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: adminlte2-rails
|