sgl-project/sglang · warning · DeprecationWarning

'data_parallel_rank' is deprecated, use 'routed_dp_rank' ins

Error message

'data_parallel_rank' is deprecated, use 'routed_dp_rank' instead.

What it means

Engine.generate/async_generate accepted a 'data_parallel_rank' argument to pick a DP rank. That name is deprecated in favor of 'routed_dp_rank'; the old value is migrated transparently (old wins only when new is unset) and a DeprecationWarning is raised.

Source

Thrown at python/sglang/srt/entrypoints/engine.py:338

        try:
            self.loop = asyncio.get_running_loop()
        except RuntimeError:
            self.loop = asyncio.new_event_loop()
            asyncio.set_event_loop(self.loop)

    def get_all_child_pids(self) -> List[int]:
        """Returns a list of all child process PIDs."""
        return self._scheduler_init_result.all_child_pids

    def _resolve_routed_dp_rank(
        self,
        routed_dp_rank: Optional[int],
        data_parallel_rank: Optional[int],
    ) -> Optional[int]:
        if data_parallel_rank is not None:
            import warnings

            warnings.warn(
                "'data_parallel_rank' is deprecated, use 'routed_dp_rank' instead.",
                DeprecationWarning,
                stacklevel=3,
            )
            if routed_dp_rank is None:
                routed_dp_rank = data_parallel_rank

        if routed_dp_rank is not None:
            dp_size = get_parallel().dp_size
            if dp_size <= 1 and routed_dp_rank == 0:
                logger.debug(
                    f"routed_dp_rank={routed_dp_rank} is ignored because dp_size={dp_size}"
                )
                return None
            if routed_dp_rank < 0 or routed_dp_rank >= dp_size:
                raise ValueError(
                    f"routed_dp_rank={routed_dp_rank} out of range [0, {dp_size})"
                )

View on GitHub (pinned to 0132848349)

Solutions

  1. Rename the kwarg to routed_dp_rank in the call
  2. Update wrappers/proxies that forward **kwargs under the old name
  3. Run with -W error::DeprecationWarning in tests to catch remaining uses

Example fix

# before
engine.generate(prompt, sampling_params, data_parallel_rank=2)
# after
engine.generate(prompt, sampling_params, routed_dp_rank=2)
Defensive patterns

Strategy: validation

Validate before calling

engine.generate(prompt, sampling_params, routed_dp_rank=rank)  # never pass data_parallel_rank

Prevention

When it happens

Trigger: Passing data_parallel_rank=... to Engine.generate / async_generate (directly or via a wrapper) instead of routed_dp_rank.

Common situations: Upgrading sglang after older DP load-balancing code was written; third-party serving frameworks that wrap the engine API and still use the old kwarg.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/df6e1d1d9c522a1a. Report an issue: GitHub.