fix password&resolution
This commit is contained in:
@@ -27,7 +27,13 @@ import dotenv
|
||||
# Load environment variables from .env file
|
||||
dotenv.load_dotenv()
|
||||
|
||||
CLIENT_PASSWORD = os.getenv("CLIENT_PASSWORD", "osworld-public-evaluation") # Default password for sudo operations
|
||||
if os.environ.get("PROVIDER_NAME") == "aws":
|
||||
os.environ["CLIENT_PASSWORD"] = os.environ.get("CLIENT_PASSWORD_AWS", "osworld-public-evaluation")
|
||||
else:
|
||||
os.environ["CLIENT_PASSWORD"] = os.environ.get("CLIENT_PASSWORD", "password")
|
||||
|
||||
CLIENT_PASSWORD = os.environ["CLIENT_PASSWORD"]
|
||||
|
||||
PROXY_CONFIG_FILE = os.getenv("PROXY_CONFIG_FILE", "evaluation_examples/settings/proxy/dataimpulse.json") # Default proxy config file
|
||||
|
||||
logger = logging.getLogger("desktopenv.setup")
|
||||
|
||||
@@ -32,7 +32,7 @@ class DesktopEnv(gym.Env):
|
||||
snapshot_name: str = "init_state",
|
||||
action_space: str = "computer_13",
|
||||
cache_dir: str = "cache",
|
||||
screen_size: Tuple[int] = (1920, 1080),
|
||||
screen_size: Tuple[int] = (int(os.environ["SCREEN_WIDTH"]), int(os.environ["SCREEN_HEIGHT"])),
|
||||
headless: bool = False,
|
||||
require_a11y_tree: bool = True,
|
||||
require_terminal: bool = False,
|
||||
|
||||
@@ -36,15 +36,22 @@ DEFAULT_REGION = "us-east-1"
|
||||
# todo: Add doc for the configuration of image, security group and network interface
|
||||
# todo: public the AMI images
|
||||
IMAGE_ID_MAP = {
|
||||
"us-east-1": "ami-09138bff939f82bd8",
|
||||
"ap-east-1": "ami-0c092a5b8be4116f5",
|
||||
"us-east-1": {
|
||||
(1920, 1080): "ami-09138bff939f82bd8"
|
||||
},
|
||||
"ap-east-1": {
|
||||
(1920, 1080): "ami-0c092a5b8be4116f5"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def _allocate_vm(region=DEFAULT_REGION):
|
||||
def _allocate_vm(region=DEFAULT_REGION, screen_size=(1920, 1080)):
|
||||
|
||||
if region not in IMAGE_ID_MAP:
|
||||
raise ValueError(f"Region {region} is not supported. Supported regions are: {list(IMAGE_ID_MAP.keys())}")
|
||||
if screen_size not in IMAGE_ID_MAP[region]:
|
||||
raise ValueError(f"Screen size {screen_size} not supported for region {region}. Supported: {list(IMAGE_ID_MAP[region].keys())}")
|
||||
ami_id = IMAGE_ID_MAP[region][screen_size]
|
||||
|
||||
ec2_client = boto3.client('ec2', region_name=region)
|
||||
instance_id = None
|
||||
@@ -86,7 +93,7 @@ def _allocate_vm(region=DEFAULT_REGION):
|
||||
run_instances_params = {
|
||||
"MaxCount": 1,
|
||||
"MinCount": 1,
|
||||
"ImageId": IMAGE_ID_MAP[region],
|
||||
"ImageId": ami_id,
|
||||
"InstanceType": INSTANCE_TYPE,
|
||||
"EbsOptimized": True,
|
||||
"NetworkInterfaces": [
|
||||
|
||||
Reference in New Issue
Block a user