in source/lib/asg.py [0:0]
def update_asg(self, action):
try:
global desired_capacity
if action == 'start_instance':
desired_capacity = 1
elif action == 'stop_instance':
desired_capacity = 0
self.logger.info("Changing desired capacity to {}".format(desired_capacity))
response = asg_client.update_auto_scaling_group(
AutoScalingGroupName=self.asg_name,
DesiredCapacity=desired_capacity
)
return response
except Exception as e:
self.logger.error("unhandled exception: AutoScaling_start_instance", exc_info=1)
return 'unhandled exception'