refactor: canonicalize launcher aliases and extract MAD_MULTI_NODE_RUNNER resolver#132
Merged
Conversation
…NNER resolver - Add canonicalize_distributed_launcher() to common.py with sglang_disagg → sglang-disagg alias - Replace inline duplicate checks in k8s_template_context.py and slurm.py with the helper - Extract _resolve_local_multi_node_runner_env() method in container_runner.py; self-managed launchers (vllm/sglang/sglang-disagg/primus) now always set MAD_MULTI_NODE_RUNNER="" so downstream scripts under set -u don't fail - Add test coverage for new helper and extracted method, including sglang_disagg alias path Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
coketaste
requested review from
Cemberk,
Rohan138,
gargrahul and
leconcio
as code owners
May 29, 2026 12:29
There was a problem hiding this comment.
Pull request overview
This PR refactors launcher alias handling and Docker-local MAD_MULTI_NODE_RUNNER resolution so distributed launcher names are canonicalized consistently and local runs get a defined runner environment variable.
Changes:
- Adds
canonicalize_distributed_launcher()with an alias map forsglang_disagg→sglang-disagg. - Extracts Docker-local multi-node runner env resolution into
_resolve_local_multi_node_runner_env(). - Adds unit coverage for launcher canonicalization and local runner command/env generation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/madengine/deployment/common.py |
Adds shared launcher alias canonicalization helper. |
src/madengine/deployment/slurm.py |
Uses canonicalization in the SGLang disaggregated launcher dispatch. |
src/madengine/deployment/k8s_template_context.py |
Uses canonicalization in Kubernetes SGLang disaggregated launcher dispatch. |
src/madengine/execution/container_runner.py |
Extracts and updates Docker-local MAD_MULTI_NODE_RUNNER resolution. |
tests/unit/test_deployment.py |
Adds tests for launcher canonicalization. |
tests/unit/test_container_runner.py |
Adds tests for local launcher command and env resolution behavior. |
CLAUDE.md |
Adds behavioral guidance documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Merge origin/develop imports: both canonicalize_distributed_launcher (this branch) and is_self_managed_launcher (develop) are now imported - Fix slurm_multi export generation: shlex.quote() returns values unquoted for safe strings, but bash convention and tests expect double-quoted exports (export KEY="value") Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
- common.py: add missing blank line after canonicalize_distributed_launcher (E305 flake8 violation) - slurm.py: canonicalize launcher aliases before normalize_launcher in _prepare_template_context so sglang_disagg reaches _generate_launcher_command as the canonical sglang-disagg instead of being silently mapped to "docker" - slurm.py: revert slurm_multi env-var export to shlex.quote (shell injection safe) from the double-quote form that was not injection-safe - test_slurm_multi.py: align export assertions with shlex.quote output Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
_prepare_template_context() already canonicalizes launcher aliases before calling normalize_launcher(), so launcher_type is always in canonical form by the time it reaches _generate_launcher_command(). Replace the redundant canonicalize_distributed_launcher() call with a direct equality check, consistent with all other launcher branches. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
A merge brought in manual double-quote escaping (PR #134) for env var values while this branch's tests expected shlex.quote output, causing two test_slurm_multi failures. Revert to shlex.quote, which is Python's standard shell-safe quoting and is already used for the script path and model args a few lines above. This restores consistency and reliably handles spaces, paths, and special characters. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
The is_flag=False/flag_value="auto" workaround emitted a DeprecationWarning at import time and was already non-functional in Typer 0.24.2 (bare --use-image errored "requires an argument"). Make --use-image a normal value option and document --use-image auto as the auto-detect form, which already works. Update docs that referenced the broken bare-flag form. Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
# Conflicts: # tests/unit/test_container_runner.py
Suppress the "Unrecognized launcher" warning for deployment-mode sentinels (docker/native) since defaulting them to torchrun is expected, not an error. Persist the normalized SLURM launcher back onto distributed_config so reporting paths see the same launcher the template used instead of re-mapping aliases (e.g. sglang_disagg) to "docker". Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
mkuznet1
added a commit
to mkuznet1/madengine
that referenced
this pull request
Jun 15, 2026
Merges 4 upstream commits (ef87d05..3a68be8) into the multi-node SLURM branch: - feat: canonicalize launcher aliases; extract MAD_MULTI_NODE_RUNNER resolver into _resolve_local_multi_node_runner_env() (upstream ROCm#132) - fix(run): --skip-model-run now starts container before skipping model script (ROCm#145) - chore: consolidate optional deps into default dependencies (ROCm#146) - Guyen/develop build-context folder change 2 (ROCm#144) Conflict in src/madengine/execution/container_runner.py resolved: - Upstream's if/else skip_model_run wrapper is the outer structure - Our try/except RuntimeError (container diagnostics on failure) is placed inside the else: branch around model_docker.sh() - Our elif skip_perf_collection: status branch and fallback or-clause are preserved in the else: branch status logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors distributed launcher handling to eliminate scattered alias branching, extracts the local Docker MAD_MULTI_NODE_RUNNER resolution into a dedicated helper, and fixes SLURM env-var quoting. Also includes a few small follow-up fixes surfaced during review.
Changes
Launcher alias canonicalization
Local Docker MAD_MULTI_NODE_RUNNER resolver
SLURM env-var quoting
CLI fix
Docs
Tests
Test plan