feat: add proxy handling logic and clean up imports (#285)
This commit is contained in:
@@ -163,6 +163,7 @@ class DesktopEnv(gym.Env):
|
|||||||
self.vlc_port = 8080
|
self.vlc_port = 8080
|
||||||
|
|
||||||
# Initialize with default (no proxy) provider
|
# Initialize with default (no proxy) provider
|
||||||
|
self.current_use_proxy = False
|
||||||
self.manager, self.provider = create_vm_manager_and_provider(provider_name, region, use_proxy=False)
|
self.manager, self.provider = create_vm_manager_and_provider(provider_name, region, use_proxy=False)
|
||||||
|
|
||||||
self.os_type = os_type
|
self.os_type = os_type
|
||||||
@@ -267,6 +268,17 @@ class DesktopEnv(gym.Env):
|
|||||||
# Only revert to snapshot if environment has been used (step/setup)
|
# Only revert to snapshot if environment has been used (step/setup)
|
||||||
# This optimization is especially important for cloud providers like AWS
|
# This optimization is especially important for cloud providers like AWS
|
||||||
# where unnecessary snapshot operations are costly and time-consuming
|
# where unnecessary snapshot operations are costly and time-consuming
|
||||||
|
|
||||||
|
if task_config is not None:
|
||||||
|
# Only consider task proxy requirement if proxy is enabled at system level
|
||||||
|
task_use_proxy = task_config.get("proxy", False) and self.enable_proxy
|
||||||
|
if not self.enable_proxy and task_config.get("proxy", False):
|
||||||
|
logger.info("Task requires proxy but proxy is disabled at system level, ignoring proxy requirement.")
|
||||||
|
|
||||||
|
if task_use_proxy != self.current_use_proxy:
|
||||||
|
# keep because get_info_from_website depend on this
|
||||||
|
self.current_use_proxy = task_use_proxy
|
||||||
|
|
||||||
if self.is_environment_used:
|
if self.is_environment_used:
|
||||||
logger.info("Environment has been used, reverting to snapshot {}...".format(self.snapshot_name))
|
logger.info("Environment has been used, reverting to snapshot {}...".format(self.snapshot_name))
|
||||||
self._revert_to_snapshot()
|
self._revert_to_snapshot()
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ import lib_run_single
|
|||||||
from desktop_env.desktop_env import DesktopEnv
|
from desktop_env.desktop_env import DesktopEnv
|
||||||
from mm_agents.anthropic import AnthropicAgent as PromptAgent
|
from mm_agents.anthropic import AnthropicAgent as PromptAgent
|
||||||
|
|
||||||
import fake_run_single as lib_run_single
|
|
||||||
from test_env import DesktopEnv
|
|
||||||
|
|
||||||
# .env
|
# .env
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|||||||
Reference in New Issue
Block a user