hako 1.5.2 → 1.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/CHANGELOG.md +6 -0
- data/lib/hako/cli.rb +3 -1
- data/lib/hako/commander.rb +3 -2
- data/lib/hako/schedulers/ecs.rb +10 -3
- data/lib/hako/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4b66507d80228e05ee0fdd78429ff9898f8ed5c
|
4
|
+
data.tar.gz: af54939a042cfcaa1a17a36a9c33a1ea822749a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a96ceada37a687ffeba40a6fd27c6133bc542ca18b959c531f823e0669147fd2be945c1bc5e7ccc8dd64a86026ef4e1ebd5fc822044ab66be2fc6896b20a8566
|
7
|
+
data.tar.gz: 6d3a66534d013a1f306f1ab1fcf9426be5cfc6f2d383b0b4bbb55a59f1793fee1414ed9697ee1fb9b99479d427915d02d08bfdec6e91fa55533e2737c1cb03e9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 1.6.0 (2017-06-23)
|
2
|
+
## New features
|
3
|
+
- Add experimental option `--no-wait` to oneshot
|
4
|
+
- `hako oneshot --no-wait` runs Docker container in background and return an identifier depending on scheduler.
|
5
|
+
- In ECS scheduler, it will output the task's ARN.
|
6
|
+
|
1
7
|
# 1.5.2 (2017-06-08)
|
2
8
|
## Bug fixes
|
3
9
|
- Retry RegisterTaskDefinition when "too many concurrent attempts" error occurs
|
data/lib/hako/cli.rb
CHANGED
@@ -144,7 +144,7 @@ module Hako
|
|
144
144
|
Hako.logger.level = Logger::DEBUG
|
145
145
|
end
|
146
146
|
|
147
|
-
Commander.new(Application.new(@yaml_path)).oneshot(@argv, tag: @tag, containers: @containers, env: @env, dry_run: @dry_run)
|
147
|
+
Commander.new(Application.new(@yaml_path)).oneshot(@argv, tag: @tag, containers: @containers, env: @env, dry_run: @dry_run, no_wait: @no_wait)
|
148
148
|
end
|
149
149
|
|
150
150
|
def parse!(argv)
|
@@ -153,6 +153,7 @@ module Hako
|
|
153
153
|
@containers = []
|
154
154
|
@env = {}
|
155
155
|
@verbose = false
|
156
|
+
@no_wait = false
|
156
157
|
parser.parse!(argv)
|
157
158
|
@yaml_path = argv.shift
|
158
159
|
@argv = argv
|
@@ -171,6 +172,7 @@ module Hako
|
|
171
172
|
opts.on('-n', '--dry-run', 'Enable dry-run mode') { @dry_run = true }
|
172
173
|
opts.on('-c', '--container=NAME', 'Additional container name to start with the app container') { |v| @containers << v }
|
173
174
|
opts.on('-v', '--verbose', 'Enable verbose logging') { @verbose = true }
|
175
|
+
opts.on('--no-wait', 'Run Docker container in background and return an identifier depending on scheduler (experimental)') { @no_wait = true }
|
174
176
|
opts.on('-e', '--env=NAME=VAL', 'Add environment variable') do |arg|
|
175
177
|
k, v = arg.split('=', 2)
|
176
178
|
@env[k] = v
|
data/lib/hako/commander.rb
CHANGED
@@ -45,8 +45,9 @@ module Hako
|
|
45
45
|
# @param [String] tag
|
46
46
|
# @param [Hash<String, String>] env
|
47
47
|
# @param [Boolean] dry_run
|
48
|
+
# @param [Boolean] no_wait
|
48
49
|
# @return [nil]
|
49
|
-
def oneshot(commands, tag:, containers:, env: {}, dry_run: false)
|
50
|
+
def oneshot(commands, tag:, containers:, env: {}, dry_run: false, no_wait: false)
|
50
51
|
containers = load_containers(tag, dry_run: dry_run, with: containers)
|
51
52
|
scripts = @app.yaml.fetch('scripts', []).map { |config| load_script(config, dry_run: dry_run) }
|
52
53
|
volumes = @app.yaml.fetch('volumes', {})
|
@@ -54,7 +55,7 @@ module Hako
|
|
54
55
|
|
55
56
|
scripts.each { |script| script.oneshot_starting(containers) }
|
56
57
|
exit_code = with_oneshot_signal_handlers(scheduler) do
|
57
|
-
scheduler.oneshot(containers, commands, env)
|
58
|
+
scheduler.oneshot(containers, commands, env, no_wait: no_wait)
|
58
59
|
end
|
59
60
|
scripts.each { |script| script.oneshot_finished(containers) }
|
60
61
|
exit exit_code
|
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -136,8 +136,9 @@ module Hako
|
|
136
136
|
# @param [Hash<String, Container>] containers
|
137
137
|
# @param [Array<String>] commands
|
138
138
|
# @param [Hash<String, String>] env
|
139
|
-
# @
|
140
|
-
|
139
|
+
# @param [Boolean] no_wait
|
140
|
+
# @return [Integer] Returns exit code
|
141
|
+
def oneshot(containers, commands, env, no_wait: false)
|
141
142
|
definitions = create_definitions(containers)
|
142
143
|
definitions.each do |definition|
|
143
144
|
definition.delete(:essential)
|
@@ -161,7 +162,12 @@ module Hako
|
|
161
162
|
@task = run_task(task_definition, commands, env)
|
162
163
|
Hako.logger.info "Started task: #{@task.task_arn}"
|
163
164
|
@scripts.each { |script| script.oneshot_started(self) }
|
164
|
-
|
165
|
+
if no_wait
|
166
|
+
puts @task.task_arn
|
167
|
+
0
|
168
|
+
else
|
169
|
+
wait_for_oneshot_finish
|
170
|
+
end
|
165
171
|
end
|
166
172
|
end
|
167
173
|
|
@@ -858,6 +864,7 @@ module Hako
|
|
858
864
|
|
859
865
|
autoscaling = Aws::AutoScaling::Client.new
|
860
866
|
interval = MIN_ASG_INTERVAL
|
867
|
+
Hako.logger.info("Unable to start tasks. Start trying scaling out '#{@autoscaling_group_for_oneshot}'")
|
861
868
|
loop do
|
862
869
|
begin
|
863
870
|
asg = autoscaling.describe_auto_scaling_groups(auto_scaling_group_names: [@autoscaling_group_for_oneshot]).auto_scaling_groups[0]
|
data/lib/hako/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hako
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Suzuki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|