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 = "https://huggingface.co/datasets/xlangai/windows_osworld/resolve/main/Windows%2010%20x64%20-%20copy.qcow2"
|
WINDOWS_X86_URL = r"https://huggingface.co/datasets/xlangai/windows_osworld/resolve/main/Windows%2010%20x64.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
|
||||||
@@ -48,7 +48,7 @@ if platform.system() == 'Windows':
|
|||||||
docker_path = r"C:\Program Files\Docker\Docker"
|
docker_path = r"C:\Program Files\Docker\Docker"
|
||||||
os.environ["PATH"] += os.pathsep + docker_path
|
os.environ["PATH"] += os.pathsep + docker_path
|
||||||
|
|
||||||
def _download_vm(vms_dir: str, os_type: str):
|
def _download_vm(vms_dir: str):
|
||||||
global URL, DOWNLOADED_FILE_NAME
|
global URL, DOWNLOADED_FILE_NAME
|
||||||
# Download the virtual machine image
|
# Download the virtual machine image
|
||||||
logger.info("Downloading the virtual machine image...")
|
logger.info("Downloading the virtual machine image...")
|
||||||
@@ -118,6 +118,7 @@ class DockerVMManager(VMManager):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_vm_path(self, os_type, region):
|
def get_vm_path(self, os_type, region):
|
||||||
|
global URL, DOWNLOADED_FILE_NAME
|
||||||
if os_type == "Ubuntu":
|
if os_type == "Ubuntu":
|
||||||
URL = WINDOWS_X86_URL
|
URL = WINDOWS_X86_URL
|
||||||
elif os_type == "Windows":
|
elif os_type == "Windows":
|
||||||
|
|||||||
@@ -33,7 +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}")
|
||||||
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": "/Ubuntu.qcow2", "mode": "ro"}}, ports={8006: self.vnc_port, 5000: self.server_port, 9222: self.chromium_port}, detach=True)
|
print(path_to_vm)
|
||||||
|
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)
|
||||||
def download_screenshot(ip, port):
|
def download_screenshot(ip, port):
|
||||||
url = f"http://{ip}:{port}/screenshot"
|
url = f"http://{ip}:{port}/screenshot"
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user