aws_communication_success

This commit is contained in:
yuanmengqi
2025-05-27 05:14:33 +00:00
parent a845824f06
commit b7e83a62ee
12 changed files with 1946 additions and 38 deletions

View File

@@ -21,14 +21,15 @@ IMAGE_ID_MAP = {
INSTANCE_TYPE = "t3.medium"
# sg-0342574803206ee9c subnet-037edfff66c2eb894
NETWORK_INTERFACE_MAP = {
"us-east-1": [
{
"SubnetId": "subnet-037edfff66c2eb894",
"SubnetId": "subnet-0a4b0c5b8f6066712",
"AssociatePublicIpAddress": True,
"DeviceIndex": 0,
"Groups": [
"sg-0342574803206ee9c"
"sg-08a53433e9b4abde6"
]
}
],
@@ -240,19 +241,20 @@ class AWSVMManager(VMManager):
AWSVMManager.checked_and_cleaned = True
self._check_and_clean()
allocation_needed = False
with self.lock:
free_vms_paths = self._list_free_vms(region)
# allocation_needed = False
# with self.lock:
# free_vms_paths = self._list_free_vms(region)
if len(free_vms_paths) == 0:
# No free virtual machine available, generate a new one
allocation_needed = True
else:
# Choose the first free virtual machine
chosen_vm_path = free_vms_paths[0][0]
self._occupy_vm(chosen_vm_path, os.getpid(), region)
return chosen_vm_path
# if len(free_vms_paths) == 0:
# # No free virtual machine available, generate a new one
# allocation_needed = True
# else:
# # Choose the first free virtual machine
# chosen_vm_path = free_vms_paths[0][0]
# self._occupy_vm(chosen_vm_path, os.getpid(), region)
# return chosen_vm_path
allocation_needed = True
if allocation_needed:
logger.info("No free virtual machine available. Generating a new one, which would take a while...☕")
new_vm_path = _allocate_vm(region)