Update
This commit is contained in:
@@ -27,7 +27,7 @@ MAX_RETRY_TIMES = 10
|
|||||||
RETRY_INTERVAL = 5
|
RETRY_INTERVAL = 5
|
||||||
|
|
||||||
UBUNTU_X86_URL = "https://huggingface.co/datasets/xlangai/ubuntu_osworld/resolve/main/Ubuntu.qcow2"
|
UBUNTU_X86_URL = "https://huggingface.co/datasets/xlangai/ubuntu_osworld/resolve/main/Ubuntu.qcow2"
|
||||||
WINDOWS_X86_URL = r"https://huggingface.co/datasets/xlangai/windows_osworld/resolve/main/Windows%2010%20x64.qcow2"
|
WINDOWS_X86_URL = r"https://huggingface.co/datasets/xlangai/windows_osworld/resolve/main/Windows%2010%20x64%20-%20copy.qcow2"
|
||||||
VMS_DIR = "./docker_vm_data"
|
VMS_DIR = "./docker_vm_data"
|
||||||
|
|
||||||
# Determine the platform and CPU architecture to decide the correct VM image to download
|
# Determine the platform and CPU architecture to decide the correct VM image to download
|
||||||
@@ -53,7 +53,7 @@ def _download_vm(vms_dir: str):
|
|||||||
# Download the virtual machine image
|
# Download the virtual machine image
|
||||||
logger.info("Downloading the virtual machine image...")
|
logger.info("Downloading the virtual machine image...")
|
||||||
downloaded_size = 0
|
downloaded_size = 0
|
||||||
|
|
||||||
downloaded_file_name = DOWNLOADED_FILE_NAME
|
downloaded_file_name = DOWNLOADED_FILE_NAME
|
||||||
|
|
||||||
os.makedirs(vms_dir, exist_ok=True)
|
os.makedirs(vms_dir, exist_ok=True)
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ class DockerProvider(Provider):
|
|||||||
|
|
||||||
def start_emulator(self, path_to_vm: str, headless: bool, os_type: str):
|
def start_emulator(self, path_to_vm: str, headless: bool, os_type: str):
|
||||||
logger.info(f"Occupying ports: {self.vnc_port}, {self.server_port}, {self.chromium_port}")
|
logger.info(f"Occupying ports: {self.vnc_port}, {self.server_port}, {self.chromium_port}")
|
||||||
print(path_to_vm)
|
uefi_rom_file = os.path.join(os.path.dirname(path_to_vm), "edk2-x86_64-code.fd")
|
||||||
self.container = self.client.containers.run("happysixd/osworld-docker", environment=self.environment, cap_add=["NET_ADMIN"], devices=["/dev/kvm"], volumes={os.path.abspath(path_to_vm): {"bind": "/System.qcow2", "mode": "ro"}}, ports={8006: self.vnc_port, 5000: self.server_port, 9222: self.chromium_port}, detach=True)
|
self.container = self.client.containers.run("osworld-docker", environment=self.environment, cap_add=["NET_ADMIN"], devices=["/dev/kvm"], volumes={os.path.abspath(path_to_vm): {"bind": "/System.qcow2", "mode": "ro"}, os.path.abspath(uefi_rom_file): {"bind": "/storage/edk2-x86_64-code.fd", "mode": "ro"}}, ports={8006: self.vnc_port, 5000: self.server_port, 9222: self.chromium_port}, detach=True)
|
||||||
def download_screenshot(ip, port):
|
def download_screenshot(ip, port):
|
||||||
url = f"http://{ip}:{port}/screenshot"
|
url = f"http://{ip}:{port}/screenshot"
|
||||||
try:
|
try:
|
||||||
@@ -63,6 +63,4 @@ class DockerProvider(Provider):
|
|||||||
logger.info("Stopping VM...")
|
logger.info("Stopping VM...")
|
||||||
self.container.stop()
|
self.container.stop()
|
||||||
self.container.remove()
|
self.container.remove()
|
||||||
time.sleep(WAIT_TIME)
|
time.sleep(WAIT_TIME)
|
||||||
|
|
||||||
# docker run -it --rm -e "DISK_SIZE=64G" -e "RAM_SIZE=8G" -e "CPU_CORES=8" --volume /home/$USER/osworld/docker_vm_data/Ubuntu.qcow2:/Ubuntu.qcow2:ro --cap-add NET_ADMIN --device /dev/kvm -p 8008:8006 -p 5002:5000 happysixd/osworld-docker
|
|
||||||
Reference in New Issue
Block a user