Skip to content

Commit bcfc3b6

Browse files
Increase Sandbox Default Thread Worker Count (#807)
1 parent 37c373d commit bcfc3b6

6 files changed

Lines changed: 20 additions & 8 deletions

File tree

environments/math_python/math_python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def load_environment(
1515
sandbox_gpu_count: int = 0,
1616
sandbox_timeout_minutes: int = 60,
1717
sandbox_timeout_per_command_seconds: int = 60,
18-
sandbox_client_max_workers: int = 10,
18+
sandbox_client_max_workers: int = 50,
1919
**kwargs,
2020
):
2121
dataset = load_example_dataset(dataset_name, dataset_split, n=num_train_examples)

verifiers/envs/experimental/cli_agent_env.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ async def setup_state(self, state: State) -> State:
133133
env_vars = await self.build_env_vars(state)
134134
docker_image = await self.get_docker_image(state)
135135

136-
sandbox_client = AsyncSandboxClient()
136+
sandbox_client = AsyncSandboxClient(
137+
max_connections=100,
138+
max_keepalive_connections=50,
139+
)
137140
sandbox_request = CreateSandboxRequest(
138141
name=rollout_id,
139142
docker_image=docker_image,
@@ -243,7 +246,10 @@ async def poll_job_completion(
243246
self, state: State, sandbox_id: str, background_job: BackgroundJob
244247
) -> None:
245248
"""Poll until background job completes, capturing output."""
246-
sandbox_client = AsyncSandboxClient()
249+
sandbox_client = AsyncSandboxClient(
250+
max_connections=100,
251+
max_keepalive_connections=50,
252+
)
247253
while True:
248254
status: BackgroundJobStatus = await sandbox_client.get_background_job(
249255
sandbox_id, background_job
@@ -793,7 +799,10 @@ async def destroy_sandbox(self, state: State):
793799
sandbox_id = state.get("sandbox_id")
794800
if sandbox_id:
795801
try:
796-
sandbox_client = AsyncSandboxClient()
802+
sandbox_client = AsyncSandboxClient(
803+
max_connections=100,
804+
max_keepalive_connections=50,
805+
)
797806
await sandbox_client.delete(sandbox_id)
798807
self.active_sandboxes.discard(sandbox_id)
799808
logger.debug(f"Deleted sandbox {sandbox_id}")

verifiers/envs/experimental/harbor_env.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,10 @@ async def compute_reward(self, state: vf.State) -> float:
213213
logger.error(f"Task directory not found: {task_dir}")
214214
return 0.0
215215

216-
sandbox_client = AsyncSandboxClient()
216+
sandbox_client = AsyncSandboxClient(
217+
max_connections=100,
218+
max_keepalive_connections=50,
219+
)
217220
try:
218221
# Upload test assets now that agent has completed
219222
await self.upload_test_assets(sandbox_client, sandbox_id, task_dir)

verifiers/envs/experimental/rlm_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,7 @@ def __init__(
24602460
sandbox_team_id: str | None = None,
24612461
sandbox_advanced_configs: Any | None = None,
24622462
sandbox_labels: list[str] | None = None,
2463-
sandbox_client_max_workers: int = 10,
2463+
sandbox_client_max_workers: int = 50,
24642464
sandbox_client_max_connections: int = 100,
24652465
sandbox_client_max_keepalive_connections: int = 50,
24662466
**kwargs,

verifiers/envs/sandbox_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def __init__(
139139
max_backoff_seconds: float = 30.0,
140140
jitter: float = 1e-3,
141141
stop_errors: list[type[Exception]] | None = None,
142-
sandbox_client_max_workers: int = 10,
142+
sandbox_client_max_workers: int = 50,
143143
sandbox_client_max_connections: int = 100,
144144
sandbox_client_max_keepalive_connections: int = 50,
145145
**kwargs,

verifiers/utils/sandbox_exec_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SandboxExecutorMixin:
1919
def _init_sandbox_executor(
2020
self,
2121
*,
22-
sandbox_client_max_workers: int = 10,
22+
sandbox_client_max_workers: int = 50,
2323
sandbox_client_max_connections: int = 100,
2424
sandbox_client_max_keepalive_connections: int = 50,
2525
max_retries: int = 5,

0 commit comments

Comments
 (0)