def reload_as_group(as_group): try: return as_group.connection.get_all_groups([as_group.name])[0] except BotoServerError as e: throttle_response(e) return reload_as_group(as_group)
def get_spot_lcs(as_conn): try: return [ l for l in as_conn.get_all_launch_configurations() if l.spot_price ] except BotoServerError as e: throttle_response(e) return get_spot_lcs(as_conn)
def terminate_instance(instance): try: instance.connection.terminate_instance( instance.instance_id, decrement_capacity=False) time.sleep(30) except BotoServerError as e: throttle_response(e) return terminate_instance(instance) except Exception as e: handle_exception(e) sys.exit(1)
def terminate_instance(instance): try: instance.connection.terminate_instance(instance.instance_id, decrement_capacity=False) time.sleep(30) except BotoServerError as e: throttle_response(e) return terminate_instance(instance) except Exception as e: handle_exception(e) sys.exit(1)
def kill_with_fire(launch_config): try: launch_config.delete() except BotoServerError as e: throttle_response(e) return kill_with_fire(launch_config)
def get_all_as_groups(as_conn): try: return as_conn.get_all_groups() except BotoServerError as e: throttle_response(e) return get_all_as_groups(as_conn)
def get_spot_lcs(as_conn): try: return [l for l in as_conn.get_all_launch_configurations() if l.spot_price] except BotoServerError as e: throttle_response(e) return get_spot_lcs(as_conn)