wrapbox 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wrapbox.rb +8 -0
- data/lib/wrapbox/runner/docker.rb +3 -1
- data/lib/wrapbox/runner/ecs.rb +8 -7
- data/lib/wrapbox/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00df8d3c0e46ae38cdef3ada6dde9db32adf2313b03d910591e98a9129b1d787
|
4
|
+
data.tar.gz: 61739c6ac9544da2b2ea83fd538831e6782ee78d9e0d2ddc8f2424e409d48474
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97c9a51c95c80f93ec16443eaca2e91890da6a1d7574f6d62be200ac2db8a997bcae61dc74da0467b3aa4aac751c81db86ea3943f86988ff78644b52efad92d3
|
7
|
+
data.tar.gz: bae99aa04b2540582132f769d0db1b20dd171956cef2bd8fb08b4d16f430365c56ba86a0c706ad37b6499ee0b037093828703d752ae0672f9d16e4ad0a1ace59
|
data/lib/wrapbox.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
require "logger"
|
2
|
+
|
1
3
|
module Wrapbox
|
2
4
|
CLASS_NAME_ENV = "WRAPBOX_CLASS_NAME".freeze
|
3
5
|
METHOD_NAME_ENV = "WRAPBOX_METHOD_NAME".freeze
|
4
6
|
METHOD_ARGS_ENV = "WRAPBOX_METHOD_ARGS".freeze
|
5
7
|
|
6
8
|
class << self
|
9
|
+
attr_accessor :logger
|
10
|
+
|
7
11
|
def load_config(filename)
|
8
12
|
configs.load_yaml(filename)
|
9
13
|
end
|
@@ -26,6 +30,10 @@ module Wrapbox
|
|
26
30
|
config.run_cmd(*args, **options)
|
27
31
|
end
|
28
32
|
end
|
33
|
+
|
34
|
+
$stdout.sync = true
|
35
|
+
self.logger = Logger.new($stdout)
|
36
|
+
self.logger.level = :info
|
29
37
|
end
|
30
38
|
|
31
39
|
require "wrapbox/version"
|
@@ -17,7 +17,7 @@ module Wrapbox
|
|
17
17
|
def initialize(options)
|
18
18
|
@name = options[:name]
|
19
19
|
@container_definitions = options[:container_definition] ? [options[:container_definition]] : options[:container_definitions]
|
20
|
-
@logger =
|
20
|
+
@logger = Wrapbox.logger
|
21
21
|
|
22
22
|
if @container_definitions.size >= 2
|
23
23
|
raise "Docker runner does not support multi container currently"
|
@@ -138,7 +138,9 @@ module Wrapbox
|
|
138
138
|
method_option :memory, type: :numeric
|
139
139
|
method_option :environments, aliases: "-e"
|
140
140
|
method_option :ignore_signal, type: :boolean, default: false, desc: "Even if receive a signal (like TERM, INT, QUIT), Docker container continue running"
|
141
|
+
method_option :verbose, aliases: "-v", type: :boolean, default: false, desc: "Verbose mode"
|
141
142
|
def run_cmd(*args)
|
143
|
+
Wrapbox.logger.level = :debug if options[:verbose]
|
142
144
|
Wrapbox.load_config(options[:config])
|
143
145
|
config = Wrapbox.configs[options[:config_name]]
|
144
146
|
environments = options[:environments].to_s.split(/,\s*/).map { |kv| kv.split("=") }.map do |k, v|
|
data/lib/wrapbox/runner/ecs.rb
CHANGED
@@ -93,8 +93,7 @@ module Wrapbox
|
|
93
93
|
|
94
94
|
@task_role_arn = options[:task_role_arn]
|
95
95
|
@execution_role_arn = options[:execution_role_arn]
|
96
|
-
|
97
|
-
@logger = Logger.new($stdout)
|
96
|
+
@logger = Wrapbox.logger
|
98
97
|
if options[:log_fetcher]
|
99
98
|
type = options[:log_fetcher][:type]
|
100
99
|
@log_fetcher = LogFetcher.new(type, options[:log_fetcher])
|
@@ -212,7 +211,7 @@ module Wrapbox
|
|
212
211
|
raise
|
213
212
|
else
|
214
213
|
execution_try_count += 1
|
215
|
-
@logger.
|
214
|
+
@logger.warn("Retry Execution after #{EXECUTION_RETRY_INTERVAL} sec (#{execution_try_count}/#{parameter.execution_retry})")
|
216
215
|
sleep EXECUTION_RETRY_INTERVAL
|
217
216
|
retry
|
218
217
|
end
|
@@ -250,7 +249,7 @@ module Wrapbox
|
|
250
249
|
task = resp.tasks[0]
|
251
250
|
|
252
251
|
resp.failures.each do |failure|
|
253
|
-
@logger.
|
252
|
+
@logger.warn("Failure: Arn=#{failure.arn}, Reason=#{failure.reason}")
|
254
253
|
end
|
255
254
|
raise LackResource unless task # this case is almost lack of container resource.
|
256
255
|
|
@@ -288,14 +287,14 @@ module Wrapbox
|
|
288
287
|
end
|
289
288
|
end
|
290
289
|
rescue LackResource
|
291
|
-
@logger.
|
290
|
+
@logger.warn("Failed to create task, because of lack resource")
|
292
291
|
put_waiting_task_count_metric(cl)
|
293
292
|
|
294
293
|
if launch_try_count >= parameter.launch_retry
|
295
294
|
raise
|
296
295
|
else
|
297
296
|
launch_try_count += 1
|
298
|
-
@logger.
|
297
|
+
@logger.warn("Retry Create Task after #{current_retry_interval} sec (#{launch_try_count}/#{parameter.launch_retry})")
|
299
298
|
sleep current_retry_interval
|
300
299
|
current_retry_interval = [current_retry_interval * parameter.retry_interval_multiplier, parameter.max_retry_interval].min
|
301
300
|
retry
|
@@ -306,7 +305,7 @@ module Wrapbox
|
|
306
305
|
raise LaunchFailure, build_error_message(task_definition_name, task.task_arn, task_status)
|
307
306
|
else
|
308
307
|
launch_try_count += 1
|
309
|
-
@logger.
|
308
|
+
@logger.warn("Retry Create Task after #{current_retry_interval} sec (#{launch_try_count}/#{parameter.launch_retry})")
|
310
309
|
sleep current_retry_interval
|
311
310
|
current_retry_interval = [current_retry_interval * parameter.retry_interval_multiplier, parameter.max_retry_interval].min
|
312
311
|
retry
|
@@ -511,7 +510,9 @@ module Wrapbox
|
|
511
510
|
method_option :execution_retry, type: :numeric
|
512
511
|
method_option :max_retry_interval, type: :numeric
|
513
512
|
method_option :ignore_signal, type: :boolean, default: false, desc: "Even if receive a signal (like TERM, INT, QUIT), ECS Tasks continue running"
|
513
|
+
method_option :verbose, aliases: "-v", type: :boolean, default: false, desc: "Verbose mode"
|
514
514
|
def run_cmd(*args)
|
515
|
+
Wrapbox.logger.level = :debug if options[:verbose]
|
515
516
|
Wrapbox.load_config(options[:config])
|
516
517
|
config = Wrapbox.configs[options[:config_name]]
|
517
518
|
environments = options[:environments].to_s.split(/,\s*/).map { |kv| kv.split("=") }.map do |k, v|
|
data/lib/wrapbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wrapbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joker1007
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-ecs
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
version: '0'
|
230
230
|
requirements: []
|
231
231
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.7.
|
232
|
+
rubygems_version: 2.7.8
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: Ruby method runner on AWS ECS
|