From ff1f2dc9972e0a4d3d2afffae2172153080f461a Mon Sep 17 00:00:00 2001 From: Mustafa Haiderbhai Date: Thu, 20 Aug 2026 16:06:50 -0700 Subject: [PATCH] Limit OpenUSD threads in LEAPP tests --- .../mh-fix-leapp-openusd-thread-limit.skip | 0 .../test/export/test_leapp_export_flow.py | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 source/isaaclab_rl/changelog.d/mh-fix-leapp-openusd-thread-limit.skip diff --git a/source/isaaclab_rl/changelog.d/mh-fix-leapp-openusd-thread-limit.skip b/source/isaaclab_rl/changelog.d/mh-fix-leapp-openusd-thread-limit.skip new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/source/isaaclab_rl/test/export/test_leapp_export_flow.py b/source/isaaclab_rl/test/export/test_leapp_export_flow.py index 8615d7738bfc..854382cc8a7c 100644 --- a/source/isaaclab_rl/test/export/test_leapp_export_flow.py +++ b/source/isaaclab_rl/test/export/test_leapp_export_flow.py @@ -11,6 +11,7 @@ from __future__ import annotations +import os import subprocess import sys import tempfile @@ -27,8 +28,10 @@ _SUBPROCESS_TIMEOUT = 600 _CHECKPOINT_BATCH_TIMEOUT = 1200 _OUTPUT_TAIL_CHARS = 5000 -# TODO: Remove once usd-core>=26.5 is the minimum. Earlier OpenUSD releases -# can corrupt the heap while parsing the Newton Franka payload concurrently. +# TODO: Remove once usd-core>=26.5 is the minimum. Earlier OpenUSD releases can +# corrupt the heap while parsing the Newton Franka payload concurrently. OpenUSD +# reads PXR_WORK_THREAD_LIMIT during process startup, before AppLauncher can apply +# its matching SimulationApp limit. _LEAPP_TEST_CPU_THREAD_LIMIT = 1 @@ -132,6 +135,7 @@ def _run_checked( list(cmd), cwd=_REPO_ROOT, capture_output=True, + env={**os.environ, "PXR_WORK_THREAD_LIMIT": str(_LEAPP_TEST_CPU_THREAD_LIMIT)}, text=True, timeout=timeout, ) @@ -266,6 +270,15 @@ def test_initialized_checkpoints(initialized_checkpoints: Path): assert not missing, f"Missing initialized checkpoints for: {', '.join(missing)}" +def test_openusd_thread_limit_is_set_before_subprocess_startup(): + """Assert LEAPP subprocesses start with OpenUSD concurrency disabled.""" + result = _run_checked( + [sys.executable, "-c", "import os; print(os.environ['PXR_WORK_THREAD_LIMIT'])"], + label="OpenUSD thread-limit probe", + ) + assert result.stdout.strip() == str(_LEAPP_TEST_CPU_THREAD_LIMIT) + + @pytest.mark.parametrize(("backend", "task_name"), _export_cases()) def test_leapp_export_flow(backend: ExportFlowBackend, task_name: str, initialized_checkpoints: Path): """Export one backend/task pair using the shared initialized checkpoint."""