Skip to content

Commit b0c7fad

Browse files
generatedunixname2129521104496973meta-codesync[bot]
authored andcommitted
Fix fbcode//pearl:test_pearl - test_construction_of_all_types (pearl.test.unit.with_pytorch.test_agent.TestAgentWithPyTorch) (T279205115)
Differential Revision: D111364356 fbshipit-source-id: 9175526fbd40f8a333b3b26f26cf40a00fd21484
1 parent 703d728 commit b0c7fad

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/unit/with_pytorch/test_agent.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# pyre-strict
1010

1111

12+
import os
1213
import time
1314
import unittest
1415
from typing import Callable, Generator, Tuple
@@ -1195,11 +1196,21 @@ def get_trained_qr_dqn_agent_and_environment(
11951196
"""
11961197

11971198
def test_construction_of_all_types(self) -> None:
1199+
# The offline agents (IQL and CQL) fetch their training datasets from an
1200+
# external URL, unreachable under network isolation (e.g. network_access=none).
1201+
# Detect isolation via the local-forkserver env var or the RE marker file,
1202+
# mirroring RemoteExecutionEnv::isInsideReNetworkIsolation().
1203+
network_isolated = os.environ.get(
1204+
"INSIDE_NETWORK_ISOLATION"
1205+
) is not None or os.path.exists("/run/re_worker/net_isolation")
11981206
for (
11991207
agent_type,
12001208
_new_agent_function,
12011209
trained_agent_function,
12021210
) in self.get_agent_makers():
1211+
if network_isolated and "offline" in agent_type:
1212+
print(f"Skipping construction of {agent_type} (requires network)")
1213+
continue
12031214
print(f"Testing construction of {agent_type}")
12041215
start = time.time()
12051216
trained_agent_function()

0 commit comments

Comments
 (0)