From 0f410a41d50e52ba223f6e672dd8da0c8f604be8 Mon Sep 17 00:00:00 2001 From: Judy Ng Date: Tue, 26 Mar 2024 17:43:00 -0400 Subject: [PATCH] hi Signed-off-by: Judy Ng --- .../tests/common/scaling_common.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/integration-tests/tests/common/scaling_common.py b/tests/integration-tests/tests/common/scaling_common.py index 5b4186fc90..9e2acf5a02 100644 --- a/tests/integration-tests/tests/common/scaling_common.py +++ b/tests/integration-tests/tests/common/scaling_common.py @@ -71,16 +71,19 @@ def get_bootstrap_errors(remote_command_executor: RemoteCommandExecutor, cluster ip_addresses_with_bootstrap_errors = remote_command_executor.run_remote_command(command=f"cat $HOME/bootstrap_errors.txt").stdout os.makedirs("bootstrap_errors", exist_ok=True) - client = boto3.client("ec2", region_name=region) for ip_address in ip_addresses_with_bootstrap_errors.splitlines(): - instance_id = client.describe_instances( - Filters=[{"Name": "private-ip-address", "Values": [ip_address]}] - )["Reservations"][0]["Instances"][0]["InstanceId"] - logging.info(f"Instance {instance_id} had bootstrap errors. Check the logs for details.") - compute_node_log = client.get_console_output(InstanceId=instance_id, Latest=True)["Output"] - with open(f"bootstrap_errors/{region}-{cluster_name}-{instance_id}-bootstrap-error.txt", "w") as file: - file.write(compute_node_log) + try: + instance_id = client.describe_instances( + Filters=[{"Name": "private-ip-address", "Values": [ip_address]}] + )["Reservations"][0]["Instances"][0]["InstanceId"] + logging.info(f"Instance {instance_id} had bootstrap errors. Check the logs for details.") + compute_node_log = client.get_console_output(InstanceId=instance_id, Latest=True)["Output"] + with open(f"bootstrap_errors/{region}-{cluster_name}-{instance_id}-bootstrap-error.txt", "w") as file: + file.write(compute_node_log) + except Exception: + logging.error("Error when retrieving the compute node logs for instance with ip address %s", ip_address) + raise def get_scaling_metrics(