Skip to content

ci: parallelize ng_test_all in-process (+max_concurrency)#1596

Closed
wprazuch wants to merge 22 commits into
mainfrom
wprazuch/ng-test-concurrency
Closed

ci: parallelize ng_test_all in-process (+max_concurrency)#1596
wprazuch wants to merge 22 commits into
mainfrom
wprazuch/ng-test-concurrency

Conversation

@wprazuch

@wprazuch wprazuch commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What

Adds +max_concurrency=N to ng_test_all (gym env test): each module still runs in its own isolated subprocess/venv, but up to N run concurrently via a ThreadPoolExecutor. Benefits both local ng_test_all and CI (no matrix sharding). run_command gains an additive capture= param so concurrent module output is collected and printed atomically instead of interleaving.

Targets martas/1434

Ported onto the unified-CLI epic (#1434): the concurrency machinery (_ModuleTestResult, _run_module_tests, _run_module_tests_all) lives in cli/env.py (where test_all now resides). Sequential (max_concurrency=1) behaviour is unchanged.

CI

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} and passes +max_concurrency=${TEST_CONCURRENCY} (TEST_CONCURRENCY repo var, default 8) — scale the runner/concurrency with no code change.

Tests

TestRunModuleTestsAll (sequential order; concurrent runs each module once; real overlap) + test_capture_pipes_combined_output. 115/115 test_cli+test_cli_setup_command+test_cli_main pass; ruff + pre-commit clean.

Supersedes the earlier matrix-sharding approach (#1577).

marta-sd added 2 commits June 12, 2026 13:40
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
@wprazuch
wprazuch requested a review from a team as a code owner June 15, 2026 07:08
@copy-pr-bot

copy-pr-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@wprazuch

Copy link
Copy Markdown
Contributor Author

Measured speedup (real CI, full 114-module suite, same ubuntu-latest runner):

Config Test-job wall-time Result
sequential (baseline) 20.1 min (1204s)
max_concurrency=4 (this PR) 10.0 min (602s) ✅ success

2.0× faster (−50%), and the concurrent run is green — no flakiness introduced at concurrency=4 on the real suite. This is on a 2-core runner (overlapping I/O-bound venv builds); a larger TEST_RUNNER + higher TEST_CONCURRENCY (repo variables) would push it further with no code change.

@wprazuch

Copy link
Copy Markdown
Contributor Author

Concurrency sweep (full suite, ubuntu-latest, both green):

concurrency Test-job wall-time vs sequential
1 (sequential) 20.1 min 1.0×
4 10.0 min 2.0×
8 9.9 min 2.0×

4 already saturates the 2-core runner, so 8 is the same speed — but it's green (no memory pressure) and gives headroom to scale once TEST_RUNNER points at a larger box. Default set to 8.

marta-sd added 5 commits June 15, 2026 13:23
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
@wprazuch
wprazuch marked this pull request as draft June 16, 2026 11:16
marta-sd added 3 commits June 16, 2026 13:39
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
wprazuch added a commit that referenced this pull request Jun 17, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
@wprazuch
wprazuch force-pushed the wprazuch/ng-test-concurrency branch from a427748 to 8e8b6df Compare June 17, 2026 08:53
@wprazuch
wprazuch changed the base branch from main to martas/1434 June 17, 2026 08:53
@wprazuch wprazuch changed the title ci: parallelize ng_test_all in-process (replaces #1577 matrix sharding) ci: parallelize ng_test_all in-process (+max_concurrency) Jun 17, 2026
marta-sd and others added 11 commits June 17, 2026 10:58
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
…nt deprecation note

Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
… to stderr)

Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
…a single --model flag

Signed-off-by: Marta Stepniewska-Dziubinska <martas@nvidia.com>
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
Shared CI fixes for the martas/1434-stacked CLI work: pin uv (0.11.20 drops
pinned deps -> 7 servers fail; = #1576) and pull main's graphwalks
example_rollouts.jsonl (fixes its data validation). This branch is the base
for the ng_validate (#1599) and config-error (#1609) PRs so the fixes live in
one place. Drop when martas/1434 rebases on main.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch added a commit that referenced this pull request Jun 22, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
@wprazuch
wprazuch force-pushed the wprazuch/ng-test-concurrency branch from 2fdee46 to eebfcf8 Compare June 22, 2026 13:45
wprazuch added a commit that referenced this pull request Jun 22, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch added a commit that referenced this pull request Jun 22, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch added a commit that referenced this pull request Jun 22, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch added a commit that referenced this pull request Jun 22, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch added a commit that referenced this pull request Jun 22, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch added a commit that referenced this pull request Jun 22, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch added a commit that referenced this pull request Jun 22, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
wprazuch added a commit that referenced this pull request Jun 22, 2026
Ports #1596 onto the unified gym CLI (#1434). Adds +max_concurrency to
ng_test_all: each module still runs in its own isolated subprocess/venv, but
up to N run concurrently via a ThreadPoolExecutor, so local ng_test_all and CI
both speed up (no matrix sharding). run_command gains an additive capture=
param so concurrent module output is collected and printed atomically.

Workflow runs on ${{ vars.TEST_RUNNER || 'ubuntu-latest' }} with
TEST_CONCURRENCY (default 8). Targets martas/1434.

Signed-off-by: Wojciech Prazuch <wprazuch@nvidia.com>
Base automatically changed from martas/1434 to main June 25, 2026 10:50
@wprazuch wprazuch closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants