add proxy
This commit is contained in:
13
dataimpulse_proxy_config.json
Normal file
13
dataimpulse_proxy_config.json
Normal file
@@ -0,0 +1,13 @@
|
||||
[
|
||||
{
|
||||
"host": "gw.dataimpulse.com",
|
||||
"port": 823,
|
||||
"username": "fba5ac061fe18be70c6c",
|
||||
"password": "3b5669b6640fc80c",
|
||||
"protocol": "http",
|
||||
"provider": "dataimpulse",
|
||||
"type": "residential",
|
||||
"country": "US",
|
||||
"note": "Dataimpulse Residential Proxy --- Tianbao Xie"
|
||||
}
|
||||
]
|
||||
@@ -47,48 +47,48 @@ class AWSProviderWithProxy(Provider):
|
||||
proxy_url = self._format_proxy_url(self.current_proxy)
|
||||
|
||||
user_data_script = f"""#!/bin/bash
|
||||
# 配置系统代理
|
||||
echo 'export http_proxy={proxy_url}' >> /etc/environment
|
||||
echo 'export https_proxy={proxy_url}' >> /etc/environment
|
||||
echo 'export HTTP_PROXY={proxy_url}' >> /etc/environment
|
||||
echo 'export HTTPS_PROXY={proxy_url}' >> /etc/environment
|
||||
# 配置系统代理
|
||||
echo 'export http_proxy={proxy_url}' >> /etc/environment
|
||||
echo 'export https_proxy={proxy_url}' >> /etc/environment
|
||||
echo 'export HTTP_PROXY={proxy_url}' >> /etc/environment
|
||||
echo 'export HTTPS_PROXY={proxy_url}' >> /etc/environment
|
||||
|
||||
# 配置apt代理
|
||||
cat > /etc/apt/apt.conf.d/95proxy << EOF
|
||||
Acquire::http::Proxy "{proxy_url}";
|
||||
Acquire::https::Proxy "{proxy_url}";
|
||||
EOF
|
||||
# 配置apt代理
|
||||
cat > /etc/apt/apt.conf.d/95proxy << EOF
|
||||
Acquire::http::Proxy "{proxy_url}";
|
||||
Acquire::https::Proxy "{proxy_url}";
|
||||
EOF
|
||||
|
||||
# 配置chrome/chromium代理
|
||||
mkdir -p /etc/opt/chrome/policies/managed
|
||||
cat > /etc/opt/chrome/policies/managed/proxy.json << EOF
|
||||
{{
|
||||
"ProxyMode": "fixed_servers",
|
||||
"ProxyServer": "{self.current_proxy.host}:{self.current_proxy.port}"
|
||||
}}
|
||||
EOF
|
||||
# 配置chrome/chromium代理
|
||||
mkdir -p /etc/opt/chrome/policies/managed
|
||||
cat > /etc/opt/chrome/policies/managed/proxy.json << EOF
|
||||
{{
|
||||
"ProxyMode": "fixed_servers",
|
||||
"ProxyServer": "{self.current_proxy.host}:{self.current_proxy.port}"
|
||||
}}
|
||||
EOF
|
||||
|
||||
# 配置firefox代理
|
||||
mkdir -p /etc/firefox/policies
|
||||
cat > /etc/firefox/policies/policies.json << EOF
|
||||
{{
|
||||
"policies": {{
|
||||
"Proxy": {{
|
||||
"Mode": "manual",
|
||||
"HTTPProxy": "{self.current_proxy.host}:{self.current_proxy.port}",
|
||||
"HTTPSProxy": "{self.current_proxy.host}:{self.current_proxy.port}",
|
||||
"UseHTTPProxyForAllProtocols": true
|
||||
}}
|
||||
}}
|
||||
}}
|
||||
EOF
|
||||
# 配置firefox代理
|
||||
mkdir -p /etc/firefox/policies
|
||||
cat > /etc/firefox/policies/policies.json << EOF
|
||||
{{
|
||||
"policies": {{
|
||||
"Proxy": {{
|
||||
"Mode": "manual",
|
||||
"HTTPProxy": "{self.current_proxy.host}:{self.current_proxy.port}",
|
||||
"HTTPSProxy": "{self.current_proxy.host}:{self.current_proxy.port}",
|
||||
"UseHTTPProxyForAllProtocols": true
|
||||
}}
|
||||
}}
|
||||
}}
|
||||
EOF
|
||||
|
||||
# 重新加载环境变量
|
||||
source /etc/environment
|
||||
# 重新加载环境变量
|
||||
source /etc/environment
|
||||
|
||||
# 记录代理配置日志
|
||||
echo "$(date): Configured proxy {self.current_proxy.host}:{self.current_proxy.port}" >> /var/log/proxy-setup.log
|
||||
"""
|
||||
# 记录代理配置日志
|
||||
echo "$(date): Configured proxy {self.current_proxy.host}:{self.current_proxy.port}" >> /var/log/proxy-setup.log
|
||||
"""
|
||||
|
||||
return base64.b64encode(user_data_script.encode()).decode()
|
||||
|
||||
@@ -99,7 +99,7 @@ echo "$(date): Configured proxy {self.current_proxy.host}:{self.current_proxy.po
|
||||
else:
|
||||
return f"{proxy.protocol}://{proxy.host}:{proxy.port}"
|
||||
|
||||
def start_emulator(self, path_to_vm: str, headless: bool):
|
||||
def start_emulator(self, path_to_vm: str, headless: bool, os_type: str):
|
||||
logger.info("Starting AWS VM with proxy configuration...")
|
||||
ec2_client = boto3.client('ec2', region_name=self.region)
|
||||
|
||||
|
||||
@@ -139,5 +139,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"proxy": false
|
||||
"proxy": true
|
||||
}
|
||||
38
evaluation_examples/test_all_error.json
Normal file
38
evaluation_examples/test_all_error.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"chrome": [
|
||||
"59155008-fe71-45ec-8a8f-dc35497b6aa8",
|
||||
"cabb3bae-cccb-41bd-9f5d-0f3a9fecd825"
|
||||
],
|
||||
"libreoffice_calc": [
|
||||
"2bd59342-0664-4ccb-ba87-79379096cc08",
|
||||
"7efeb4b1-3d19-4762-b163-63328d66303b",
|
||||
"8b1ce5f2-59d2-4dcc-b0b0-666a714b9a14"
|
||||
],
|
||||
"libreoffice_impress": [
|
||||
"455d3c66-7dc6-4537-a39a-36d3e9119df7",
|
||||
"3b27600c-3668-4abd-8f84-7bcdebbccbdb",
|
||||
"bf4e9888-f10f-47af-8dba-76413038b73c",
|
||||
"e4ef0baf-4b52-4590-a47e-d4d464cca2d7"
|
||||
],
|
||||
"multi_apps": [
|
||||
"46407397-a7d5-4c6b-92c6-dbe038b1457b",
|
||||
"4e9f0faf-2ecc-4ae8-a804-28c9a75d1ddc",
|
||||
"78aed49a-a710-4321-a793-b611a7c5b56b",
|
||||
"897e3b53-5d4d-444b-85cb-2cdc8a97d903",
|
||||
"a0b9dc9c-fc07-4a88-8c5d-5e3ecad91bcb",
|
||||
"b52b40a5-ad70-4c53-b5b0-5650a8387052",
|
||||
"0c825995-5b70-4526-b663-113f4c999dd2",
|
||||
"337d318b-aa07-4f4f-b763-89d9a2dd013f",
|
||||
"9219480b-3aed-47fc-8bac-d2cffc5849f7",
|
||||
"e2392362-125e-4f76-a2ee-524b183a3412",
|
||||
"22a4636f-8179-4357-8e87-d1743ece1f81"
|
||||
],
|
||||
"os": [
|
||||
"a462a795-fdc7-4b23-b689-e8b6df786b78"
|
||||
],
|
||||
"vlc": [
|
||||
"8f080098-ddb1-424c-b438-4e96e5e4786e",
|
||||
"bba3381f-b5eb-4439-bd9e-80c22218d5a7",
|
||||
"7882ed6e-bece-4bf0-bada-c32dc1ddae72"
|
||||
]
|
||||
}
|
||||
14
evaluation_examples/test_all_error2.json
Normal file
14
evaluation_examples/test_all_error2.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"libreoffice_calc": [
|
||||
"7efeb4b1-3d19-4762-b163-63328d66303b"
|
||||
],
|
||||
"libreoffice_impress": [
|
||||
"455d3c66-7dc6-4537-a39a-36d3e9119df7",
|
||||
"3b27600c-3668-4abd-8f84-7bcdebbccbdb"
|
||||
],
|
||||
"multi_apps": [
|
||||
"a0b9dc9c-fc07-4a88-8c5d-5e3ecad91bcb",
|
||||
"337d318b-aa07-4f4f-b763-89d9a2dd013f",
|
||||
"e2392362-125e-4f76-a2ee-524b183a3412"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"chrome": [
|
||||
"bb5e4c0d-f964-439c-97b6-bdb9747de3f4"
|
||||
"6c4c23a1-42a4-43cc-9db1-2f86ff3738cc"
|
||||
],
|
||||
"multi_apps": [
|
||||
"d1acdb87-bb67-4f30-84aa-990e56a09c92"
|
||||
]
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
# Do not write any secret keys or sensitive information here.
|
||||
|
||||
# Monitor configuration
|
||||
TASK_CONFIG_PATH=../evaluation_examples/test_small_test2.json
|
||||
TASK_CONFIG_PATH=../evaluation_examples/test_all_error.json
|
||||
EXAMPLES_BASE_PATH=../evaluation_examples/examples
|
||||
RESULTS_BASE_PATH=../results_operator_timeoutcheck3/pyautogui/screenshot/computer-use-preview
|
||||
RESULTS_BASE_PATH=../results_all_error/pyautogui/screenshot/computer-use-preview
|
||||
MAX_STEPS=150
|
||||
FLASK_PORT=80
|
||||
FLASK_HOST=0.0.0.0
|
||||
|
||||
@@ -2,7 +2,7 @@ python run_multienv_openaicua.py \
|
||||
--headless \
|
||||
--observation_type screenshot \
|
||||
--model computer-use-preview \
|
||||
--result_dir ./results_operator_timeoutcheck3 \
|
||||
--test_all_meta_path evaluation_examples/test_small_test2.json \
|
||||
--result_dir ./results_all_error \
|
||||
--test_all_meta_path evaluation_examples/test_all_error.json \
|
||||
--region us-east-1 \
|
||||
--max_steps 150
|
||||
|
||||
Reference in New Issue
Block a user