hako 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/hako/schedulers/ecs.rb +18 -5
- 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: be720c4761b90dbbae3c8d302cbe3c50421c915a
|
4
|
+
data.tar.gz: 40a6297d8e167ea157cb3080749d56c70ab9cbe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5f6863cebd0493b0d47a72bc82296490195446aa8a8fd74a2f401f0b67046aa472f14266928ceba3e71694da7aa8a5050d4e6bfa81399cdb44a552c5600e2e4
|
7
|
+
data.tar.gz: 13e21ae6fa1ae860a5598f8abe5910b5b8e759889ec9a439f9984b79d407588c4b43719a51f90b09eb2bd1530913f1993fb206e54bad07d172330b18c240fc7b
|
data/CHANGELOG.md
CHANGED
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -815,6 +815,8 @@ module Hako
|
|
815
815
|
raise "Unable to find rollback target. #{task_definition.task_definition_arn} is INACTIVE?"
|
816
816
|
end
|
817
817
|
|
818
|
+
MIN_ASG_INTERVAL = 1
|
819
|
+
MAX_ASG_INTERVAL = 120
|
818
820
|
# @param [Aws::ECS::Types::TaskDefinition] task_definition
|
819
821
|
# @return [Boolean] true if the capacity is reserved
|
820
822
|
def on_no_tasks_started(task_definition)
|
@@ -823,8 +825,17 @@ module Hako
|
|
823
825
|
end
|
824
826
|
|
825
827
|
autoscaling = Aws::AutoScaling::Client.new
|
828
|
+
interval = MIN_ASG_INTERVAL
|
826
829
|
loop do
|
827
|
-
|
830
|
+
begin
|
831
|
+
asg = autoscaling.describe_auto_scaling_groups(auto_scaling_group_names: [@autoscaling_group_for_oneshot]).auto_scaling_groups[0]
|
832
|
+
rescue Aws::AutoScaling::Errors::Throttling => e
|
833
|
+
Hako.logger.error(e)
|
834
|
+
interval = [interval * 2, MAX_ASG_INTERVAL].min
|
835
|
+
Hako.logger.info("Retrying after #{interval} seconds...")
|
836
|
+
sleep interval
|
837
|
+
next
|
838
|
+
end
|
828
839
|
unless asg
|
829
840
|
raise Error.new("AutoScaling Group '#{@autoscaling_group_for_oneshot}' does not exist")
|
830
841
|
end
|
@@ -835,11 +846,12 @@ module Hako
|
|
835
846
|
return true
|
836
847
|
end
|
837
848
|
|
849
|
+
interval = [interval / 2, MIN_ASG_INTERVAL].max
|
838
850
|
# Check autoscaling group health
|
839
851
|
current = asg.instances.count { |i| i.lifecycle_state == 'InService' }
|
840
852
|
if asg.desired_capacity != current
|
841
|
-
Hako.logger.debug("#{asg.auto_scaling_group_name} isn't in desired state. desired_capacity=#{asg.desired_capacity} in-service instances=#{current}")
|
842
|
-
sleep
|
853
|
+
Hako.logger.debug("#{asg.auto_scaling_group_name} isn't in desired state. desired_capacity=#{asg.desired_capacity} in-service instances=#{current}. Retry after #{interval} seconds")
|
854
|
+
sleep interval
|
843
855
|
next
|
844
856
|
end
|
845
857
|
|
@@ -849,8 +861,8 @@ module Hako
|
|
849
861
|
out_instances.delete(ci.ec2_instance_id)
|
850
862
|
end
|
851
863
|
unless out_instances.empty?
|
852
|
-
Hako.logger.debug("There's instances that is running but not registered as container instances: #{out_instances}")
|
853
|
-
sleep
|
864
|
+
Hako.logger.debug("There's instances that is running but not registered as container instances: #{out_instances}. Retry after #{interval} seconds")
|
865
|
+
sleep interval
|
854
866
|
next
|
855
867
|
end
|
856
868
|
|
@@ -858,6 +870,7 @@ module Hako
|
|
858
870
|
desired = current + 1
|
859
871
|
Hako.logger.info("Increment desired_capacity of #{asg.auto_scaling_group_name} from #{current} to #{desired}")
|
860
872
|
autoscaling.set_desired_capacity(auto_scaling_group_name: asg.auto_scaling_group_name, desired_capacity: desired)
|
873
|
+
sleep interval
|
861
874
|
end
|
862
875
|
end
|
863
876
|
|
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.3.
|
4
|
+
version: 1.3.1
|
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-05-
|
11
|
+
date: 2017-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|