Skip to content

Commit 71ea95c

Browse files
Fix key pair file deletion logic during efa test (#5257)
* add vllm arm64 to release * test efa * try tf 2.19 * try tf 2.19 * Revert toml * remove pr context * remove pr context
1 parent 0498bfc commit 71ea95c

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

test/dlc_tests/conftest.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -600,11 +600,9 @@ def ec2_instance(
600600
key_filename = test_utils.generate_ssh_keypair(ec2_client, ec2_key_name)
601601

602602
def delete_ssh_keypair():
603-
if test_utils.is_pr_context():
604-
test_utils.destroy_ssh_keypair(ec2_client, key_filename)
605-
else:
606-
with open(KEYS_TO_DESTROY_FILE, "a") as destroy_keys:
607-
destroy_keys.write(f"{key_filename}\n")
603+
# test_utils.destroy_ssh_keypair(ec2_client, key_filename)
604+
with open(KEYS_TO_DESTROY_FILE, "a") as destroy_keys:
605+
destroy_keys.write(f"{key_filename}\n")
608606

609607
request.addfinalizer(delete_ssh_keypair)
610608
print(f"EC2 instance AMI-ID: {ec2_instance_ami}")

test/testrunner.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,16 @@ def delete_key_pairs(keyfile):
263263
264264
:param keyfile: file with all of the keys to delete
265265
"""
266-
with open(keyfile) as key_destroy_file:
267-
for key_file in key_destroy_file:
268-
LOGGER.info(key_file)
269-
ec2_client = boto3.client("ec2", config=Config(retries={"max_attempts": 10}))
270-
if ".pem" in key_file:
271-
_resp, keyname = destroy_ssh_keypair(ec2_client, key_file)
272-
LOGGER.info(f"Deleted {keyname}")
266+
try:
267+
with open(keyfile) as key_destroy_file:
268+
for key_file in key_destroy_file:
269+
LOGGER.info(f"destroying {key_file} listed in {key_destroy_file}")
270+
ec2_client = boto3.client("ec2", config=Config(retries={"max_attempts": 10}))
271+
if ".pem" in key_file:
272+
_resp, keyname = destroy_ssh_keypair(ec2_client, key_file)
273+
LOGGER.info(f"Deleted {keyname}")
274+
except Exception as e:
275+
LOGGER.error(f"Failed to delete key pair with exception: {e}")
273276

274277

275278
def build_bai_docker_container():

0 commit comments

Comments
 (0)