Skip to content

feat(slurm): run the Mooncake master and node clients through the shared entrypoints - #4920

Draft
samsja wants to merge 2 commits into
feat/k8s-mooncake-offload-eng-9128from
feat/slurm-mooncake-entrypoint
Draft

samsja wants to merge 2 commits into
feat/k8s-mooncake-offload-eng-9128from
feat/slurm-mooncake-entrypoint

Conversation

@samsja

@samsja samsja commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #4916. With this, the SLURM launch starts Mooncake the same way the Kubernetes operator does: both go through the shared prime-rl entrypoints, and neither builds mooncake_master or mooncake_client flags in shell.

Change

  • Master: the head node runs python -m prime_rl.entrypoints.mooncake @ inference.json. Under P/D it adds --role-configs inference-prefill.json inference-decode.json. With an RL multi_node deployment, SLURM's inference.json has no deployment, so the master can't read the per-role offloads from it and is handed the role configs instead. The master's -default_kv_lease_ttl (the larger role's lease_ttl_s) and its ports now come from one place.
  • Node client: there is a new python -m prime_rl.entrypoints.mooncake_client @ <role config> --master-host <head>. It calls setup_mooncake_client: it waits for the master, starts mooncake_client with the node's cpu.num_bytes, writes the standalone-store JSON to MOONCAKE_CONFIG_PATH, then stays in the foreground and forwards SIGTERM/SIGINT to the client. On SLURM one client runs per node, not per rank, so the vLLM ranks don't get MOONCAKE_MASTER_HOST and inference_local doesn't start a client of its own.
  • _mooncake_store.sh.j2 now only places these two processes. It waits for the config file and fails the job, with the client's log tail, if the client dies first. inference.sbatch.j2 points MC_BASE_CONFIG at the standalone inference config.
  • Docs and a unit test render the colocated and the P/D sbatch scripts, assert the entrypoint commands, check that --role-configs appears only under P/D and that no raw master/client flags remain, and run bash -n on the result.

Tested on research-main (SLURM, H200, partition all, 2 nodes)

Colocated: multi_node × 2, Qwen3-0.6B, cpu.num_bytes = 8 GiB (job 22455)

  • The master started from the entrypoint with -rpc_port=50051 -enable_http_metadata_server … -default_kv_lease_ttl=30000. Both nodes joined the pool: Clients: 2, Mem Storage: … / 16.00 GB.
  • Both nodes logged [mooncake] node N … role=all joined shared pool: master=…-030:50051 contributed_bytes=8589934592.
  • After the same prompt was sent repeatedly through the router, the store held 46 keys (322 MB). The other ranks loaded the prefix from it with External prefix cache hit rate: 98%, load_get_failed_keys=0, load_get_error_count=0.

P/D: disaggregated, 1 prefill node + 1 decode node, Qwen3-30B-A3B (job 22472)

  • The master ran as python -m prime_rl.entrypoints.mooncake @ inference.json --role-configs inference-prefill.json inference-decode.json.
  • The clients ran from their role configs and logged role=prefill / role=decode joined shared pool. Completions through the P/D router came back fine, the store held 50 keys, and the ranks logged External prefix cache hit rate: 100%.
  • A dense model can't be tested under SLURM P/D: vLLM rejects external DP for non-MoE models. That limitation predates this PR.

Local: pytest tests/unit/test_pd_launch.py passes (10 tests).

🤖 Generated with Claude Code

cabrinha and others added 2 commits December 2, 2026 18:11
…red prime-rl entrypoints

The SLURM templates built mooncake_master and mooncake_client command lines and
the standalone-store JSON in bash (_mooncake_store.sh.j2), a second copy of
what prime_rl.entrypoints.mooncake does for Kubernetes. The two had already
drifted (device-name precedence).

- The head node runs `python -m prime_rl.entrypoints.mooncake @ <inference config>`,
  with `--role-configs inference-prefill.json inference-decode.json` under P/D.
- New `python -m prime_rl.entrypoints.mooncake_client`: one node's client from
  its resolved engine config, reusing setup_mooncake_client. SLURM runs one
  `inference` per DP rank, so the template runs it once per node in the
  background and waits for MOONCAKE_CONFIG_PATH before starting the ranks; the
  ranks never start a client (MOONCAKE_MASTER_HOST stays unset). A client that
  dies now fails the job through the template's wait -n loop.
- A stale config from an earlier attempt is removed first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cabrinha
cabrinha force-pushed the feat/k8s-mooncake-offload-eng-9128 branch from 3f18da8 to 54d3af0 Compare December 3, 2026 21:00

This branch has not been deployed

No deployments
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