Skip to content

Commit

Permalink
Merge pull request #3 from jaash7zohz/asg_invert2
Browse files Browse the repository at this point in the history
[autoscaling] Change order for starting ASG
  • Loading branch information
diodonfrost authored Feb 24, 2020
2 parents 072eec8 + e2762cd commit c420b18
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions package/scheduler/autoscaling_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ def start(self, tag_key: str, tag_value: str) -> None:
asg_list = self.list_groups(tag_key, tag_value)
instance_list = self.list_instances(asg_list)

for asg_name in asg_list:
try:
self.asg.resume_processes(AutoScalingGroupName=asg_name)
print("Resume autoscaling group {0}".format(asg_name))
except ClientError as exc:
ec2_exception("autoscaling group", asg_name, exc)

# Start autoscaling instance
for ec2_instance in instance_list:
try:
Expand All @@ -81,6 +74,13 @@ def start(self, tag_key: str, tag_value: str) -> None:
except ClientError as exc:
ec2_exception("instance", ec2_instance, exc)

for asg_name in asg_list:
try:
self.asg.resume_processes(AutoScalingGroupName=asg_name)
print("Resume autoscaling group {0}".format(asg_name))
except ClientError as exc:
ec2_exception("autoscaling group", asg_name, exc)

def list_groups(self, tag_key: str, tag_value: str) -> List[str]:
"""Aws autoscaling list function.
Expand Down

0 comments on commit c420b18

Please sign in to comment.