add nogui parameter to environment
This commit is contained in:
@@ -49,7 +49,8 @@ class DesktopEnv(gym.Env):
|
||||
task_config: Dict[str, Any] = None,
|
||||
tmp_dir: str = "tmp",
|
||||
cache_dir: str = "cache",
|
||||
screen_size: Tuple[int] = (1920, 1080)
|
||||
screen_size: Tuple[int] = (1920, 1080),
|
||||
headless: bool = False
|
||||
):
|
||||
"""
|
||||
Args:
|
||||
@@ -75,6 +76,7 @@ class DesktopEnv(gym.Env):
|
||||
self.tmp_dir_base: str = tmp_dir
|
||||
self.cache_dir_base: str = cache_dir
|
||||
self.vm_screen_size = screen_size
|
||||
self.headless = headless
|
||||
|
||||
os.makedirs(self.tmp_dir_base, exist_ok=True)
|
||||
|
||||
@@ -116,7 +118,8 @@ class DesktopEnv(gym.Env):
|
||||
break
|
||||
else:
|
||||
logger.info("Starting VM...")
|
||||
_execute_command(["vmrun", "-T", "ws", "start", self.path_to_vm])
|
||||
_execute_command(["vmrun", "-T", "ws", "start", self.path_to_vm]) if not self.headless \
|
||||
else _execute_command(["vmrun", "-T", "ws", "start", self.path_to_vm, "nogui"])
|
||||
time.sleep(3)
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error(f"Error executing command: {e.output.decode().strip()}")
|
||||
|
||||
Reference in New Issue
Block a user