Update
This commit is contained in:
@@ -25,7 +25,9 @@ logger.setLevel(logging.INFO)
|
||||
|
||||
MAX_RETRY_TIMES = 10
|
||||
RETRY_INTERVAL = 5
|
||||
UBUNTU_X86_URL = "docker-osworld-x86"
|
||||
|
||||
UBUNTU_X86_URL = "https://huggingface.co/datasets/xlangai/ubuntu_osworld/resolve/main/Ubuntu.qcow2"
|
||||
VMS_DIR = "./docker_vm_data"
|
||||
|
||||
# Determine the platform and CPU architecture to decide the correct VM image to download
|
||||
# if platform.system() == 'Darwin': # macOS
|
||||
@@ -37,7 +39,6 @@ UBUNTU_X86_URL = "docker-osworld-x86"
|
||||
# URL = UBUNTU_X86_URL
|
||||
# else:
|
||||
# raise Exception("Unsupported platform or architecture")
|
||||
|
||||
URL = UBUNTU_X86_URL
|
||||
|
||||
DOWNLOADED_FILE_NAME = URL.split('/')[-1]
|
||||
@@ -46,10 +47,7 @@ if platform.system() == 'Windows':
|
||||
docker_path = r"C:\Program Files\Docker\Docker"
|
||||
os.environ["PATH"] += os.pathsep + docker_path
|
||||
|
||||
UBUNTU_X86_URL = "https://huggingface.co/datasets/xlangai/ubuntu_osworld/resolve/main/Ubuntu.qcow2"
|
||||
VMS_DIR = "./vmware_vm_data"
|
||||
|
||||
def __download_vm(vms_dir: str):
|
||||
def _download_vm(vms_dir: str):
|
||||
# Download the virtual machine image
|
||||
logger.info("Downloading the virtual machine image...")
|
||||
downloaded_size = 0
|
||||
@@ -58,6 +56,8 @@ def __download_vm(vms_dir: str):
|
||||
DOWNLOADED_FILE_NAME = URL.split('/')[-1]
|
||||
downloaded_file_name = DOWNLOADED_FILE_NAME
|
||||
|
||||
os.makedirs(vms_dir, exist_ok=True)
|
||||
|
||||
while True:
|
||||
downloaded_file_path = os.path.join(vms_dir, downloaded_file_name)
|
||||
headers = {}
|
||||
@@ -99,7 +99,25 @@ class DockerVMManager(VMManager):
|
||||
def __init__(self, registry_path=""):
|
||||
pass
|
||||
|
||||
def get_vm_path(self, region):
|
||||
def add_vm(self, vm_path):
|
||||
pass
|
||||
|
||||
def check_and_clean(self):
|
||||
pass
|
||||
|
||||
def delete_vm(self, vm_path):
|
||||
pass
|
||||
|
||||
def initialize_registry(self):
|
||||
pass
|
||||
|
||||
def list_free_vms(self):
|
||||
return os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)
|
||||
|
||||
def occupy_vm(self, vm_path):
|
||||
pass
|
||||
|
||||
def get_vm_path(self, os_type, region):
|
||||
if not os.path.exists(os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)):
|
||||
__download_vm(VMS_DIR)
|
||||
_download_vm(VMS_DIR)
|
||||
return os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)
|
||||
Reference in New Issue
Block a user