-
Notifications
You must be signed in to change notification settings - Fork 0
Fix pipeline prefill short-prompt wedge + dashboard kv-backend display #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
3259322
Fix pipeline_parallel_prefill short-prompt wedge + dashboard kv-backe…
edf7145
Temporarily bypass LLM warmup for debugging
70e4192
Add pipeline wrapper hang instrumentation
430462e
Handle closed worker info event stream
cc0c033
Allow warmup planning to tolerate ready peers
b91a99b
Make Gemma warmup more representative
4c6000f
Test Gemma 4 prompts without empty thought suffix
2e4fdf8
Trace warmup and first live request shapes
66392df
Use hello warmup prompt for MLX isolation
e252ccc
Restore sampler settings for warmup bisect
1b4d3ee
Restore warmup instructions for bisect
f55a421
Revert "Restore warmup instructions for bisect"
b206f87
Disable pipeline prefill mode for short warmup path
a7be93f
Retry warmup instructions after prefill fix
dab0b00
Retry longer warmup content after prefill fix
12e3cdd
Revert "Retry longer warmup content after prefill fix"
16d5a1c
Try neutral padded warmup content
1fd6824
Clean up stale runners on node timeout
bc0c7ae
Raise warmup output budget for bisect
3d54e87
Add runner lifecycle debug logging
a22effd
Make pipeline warmup prompt length configurable
4520e61
Make warmup instructions opt-in for debugging
f1df109
Force minimal warmup for pipeline models
097685e
Document pipeline warmup policy and debug env vars
6ae7078
Address high-severity PR review findings
431559c
Tighten warmup skip and add review regression tests
2302c41
Bound warmup decode to the first token
e7a1d59
Tighten warmup planner and debug helpers
9163d8d
Tighten env precedence for warmup and debug config
33f8c0f
Normalize invalid KV backend values in config
3312c29
Keep warmup cancel checks from becoming too frequent
2cb8e00
Deduplicate env precedence and KV backend validation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # pyright: reportUnusedFunction=false, reportPrivateUsage=false | ||
| """Tests for the GET /config API endpoint.""" | ||
|
|
||
| from pathlib import Path | ||
| from typing import Any | ||
|
|
||
| import pytest | ||
| from fastapi.testclient import TestClient | ||
|
|
||
| from exo.api.main import API | ||
| from exo.shared.types.common import NodeId | ||
| from exo.utils.channels import channel | ||
|
|
||
|
|
||
| def _build_api(node_id: str = "test-node") -> API: | ||
| """Create a minimal API instance for config endpoint testing.""" | ||
| command_sender, _ = channel() | ||
| download_sender, _ = channel() | ||
| _, event_receiver = channel() | ||
| _, election_receiver = channel() | ||
| return API( | ||
| NodeId(node_id), | ||
| port=52415, | ||
| event_receiver=event_receiver, | ||
| command_sender=command_sender, | ||
| download_command_sender=download_sender, | ||
| election_receiver=election_receiver, | ||
| enable_event_log=False, | ||
| mount_dashboard=False, | ||
| ) | ||
|
|
||
|
|
||
| def test_get_config_reports_effective_kv_backend_when_file_exists( | ||
| tmp_path: Path, monkeypatch: pytest.MonkeyPatch | ||
| ) -> None: | ||
| config_path = tmp_path / "exo.yaml" | ||
| config_path.write_text( | ||
| "inference:\n kv_cache_backend: default\nhf_token: secret-token\n", | ||
| encoding="utf-8", | ||
| ) | ||
| monkeypatch.setenv("SKULK_KV_CACHE_BACKEND", "optiq") | ||
|
|
||
| api = _build_api() | ||
| api._config_path = config_path # pyright: ignore[reportPrivateUsage] | ||
| client = TestClient(api.app) | ||
|
|
||
| response = client.get("/config") | ||
|
|
||
| assert response.status_code == 200 | ||
| data: dict[str, Any] = response.json() | ||
| assert data["fileExists"] is True | ||
| assert data["configPath"] == str(config_path) | ||
| assert data["config"]["inference"]["kv_cache_backend"] == "default" | ||
| assert data["config"].get("hf_token") is None | ||
| assert data["effective"]["kv_cache_backend"] == "optiq" | ||
| assert data["effective"]["has_hf_token"] is True | ||
|
|
||
|
|
||
| def test_get_config_treats_blank_skulk_kv_backend_as_default( | ||
| tmp_path: Path, monkeypatch: pytest.MonkeyPatch | ||
| ) -> None: | ||
| config_path = tmp_path / "exo.yaml" | ||
| config_path.write_text("inference:\n kv_cache_backend: default\n", encoding="utf-8") | ||
| monkeypatch.setenv("SKULK_KV_CACHE_BACKEND", "") | ||
| monkeypatch.setenv("EXO_KV_CACHE_BACKEND", "optiq") | ||
|
|
||
| api = _build_api() | ||
| api._config_path = config_path # pyright: ignore[reportPrivateUsage] | ||
| client = TestClient(api.app) | ||
|
|
||
| response = client.get("/config") | ||
|
|
||
| assert response.status_code == 200 | ||
| data: dict[str, Any] = response.json() | ||
| assert data["effective"]["kv_cache_backend"] == "default" | ||
|
|
||
|
|
||
| def test_get_config_treats_invalid_skulk_kv_backend_as_default( | ||
| tmp_path: Path, monkeypatch: pytest.MonkeyPatch | ||
| ) -> None: | ||
| config_path = tmp_path / "exo.yaml" | ||
| config_path.write_text("inference:\n kv_cache_backend: default\n", encoding="utf-8") | ||
| monkeypatch.setenv("SKULK_KV_CACHE_BACKEND", "typo-backend") | ||
|
|
||
| api = _build_api() | ||
| api._config_path = config_path # pyright: ignore[reportPrivateUsage] | ||
| client = TestClient(api.app) | ||
|
|
||
| response = client.get("/config") | ||
|
|
||
| assert response.status_code == 200 | ||
| data: dict[str, Any] = response.json() | ||
| assert data["effective"]["kv_cache_backend"] == "default" |
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
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
138 changes: 138 additions & 0 deletions
138
src/exo/shared/tests/test_apply/test_apply_node_timed_out.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| from datetime import datetime | ||
|
|
||
| from exo.shared.apply import apply_node_timed_out | ||
| from exo.shared.models.model_cards import ModelCard, ModelId, ModelTask | ||
| from exo.shared.types.common import NodeId | ||
| from exo.shared.types.events import NodeTimedOut | ||
| from exo.shared.types.memory import Memory | ||
| from exo.shared.types.profiling import NodeIdentity | ||
| from exo.shared.types.state import State | ||
| from exo.shared.types.tasks import StartWarmup, TaskId, TaskStatus | ||
| from exo.shared.types.worker.instances import InstanceId, MlxRingInstance | ||
| from exo.shared.types.worker.runners import ( | ||
| RunnerId, | ||
| RunnerIdle, | ||
| RunnerReady, | ||
| RunnerWarmingUp, | ||
| ShardAssignments, | ||
| ) | ||
| from exo.shared.types.worker.shards import PipelineShardMetadata | ||
|
|
||
|
|
||
| def _make_pipeline_shard(model_id: ModelId, device_rank: int, world_size: int) -> PipelineShardMetadata: | ||
| return PipelineShardMetadata( | ||
| model_card=ModelCard( | ||
| model_id=model_id, | ||
| storage_size=Memory.from_mb(100000), | ||
| n_layers=32, | ||
| hidden_size=2048, | ||
| supports_tensor=False, | ||
| tasks=[ModelTask.TextGeneration], | ||
| ), | ||
| device_rank=device_rank, | ||
| world_size=world_size, | ||
| start_layer=0, | ||
| end_layer=32, | ||
| n_layers=32, | ||
| ) | ||
|
|
||
|
|
||
| def test_apply_node_timed_out_removes_affected_instances_runners_and_tasks() -> None: | ||
| node_a = NodeId("node-a") | ||
| node_b = NodeId("node-b") | ||
| node_c = NodeId("node-c") | ||
|
|
||
| affected_instance_id = InstanceId("affected-instance") | ||
| unaffected_instance_id = InstanceId("unaffected-instance") | ||
|
|
||
| affected_runner_a = RunnerId("affected-runner-a") | ||
| affected_runner_b = RunnerId("affected-runner-b") | ||
| unaffected_runner = RunnerId("unaffected-runner") | ||
|
|
||
| model_id = ModelId("mlx-community/gemma-4-26b-a4b-it-4bit") | ||
|
|
||
| affected_instance = MlxRingInstance( | ||
| instance_id=affected_instance_id, | ||
| shard_assignments=ShardAssignments( | ||
| model_id=model_id, | ||
| node_to_runner={ | ||
| node_a: affected_runner_a, | ||
| node_b: affected_runner_b, | ||
| }, | ||
| runner_to_shard={ | ||
| affected_runner_a: _make_pipeline_shard(model_id, device_rank=0, world_size=2), | ||
| affected_runner_b: _make_pipeline_shard(model_id, device_rank=1, world_size=2), | ||
| }, | ||
| ), | ||
| hosts_by_node={}, | ||
| ephemeral_port=50000, | ||
| ) | ||
|
|
||
| unaffected_instance = MlxRingInstance( | ||
| instance_id=unaffected_instance_id, | ||
| shard_assignments=ShardAssignments( | ||
| model_id=model_id, | ||
| node_to_runner={node_c: unaffected_runner}, | ||
| runner_to_shard={ | ||
| unaffected_runner: _make_pipeline_shard(model_id, device_rank=0, world_size=1), | ||
| }, | ||
| ), | ||
| hosts_by_node={}, | ||
| ephemeral_port=50001, | ||
| ) | ||
|
|
||
| affected_task_id = TaskId("affected-task") | ||
| unaffected_task_id = TaskId("unaffected-task") | ||
| state = State( | ||
| instances={ | ||
| affected_instance_id: affected_instance, | ||
| unaffected_instance_id: unaffected_instance, | ||
| }, | ||
| runners={ | ||
| affected_runner_a: RunnerWarmingUp(), | ||
| affected_runner_b: RunnerReady(), | ||
| unaffected_runner: RunnerIdle(), | ||
| }, | ||
| tasks={ | ||
| affected_task_id: StartWarmup( | ||
| task_id=affected_task_id, | ||
| instance_id=affected_instance_id, | ||
| task_status=TaskStatus.Pending, | ||
| ), | ||
| unaffected_task_id: StartWarmup( | ||
| task_id=unaffected_task_id, | ||
| instance_id=unaffected_instance_id, | ||
| task_status=TaskStatus.Pending, | ||
| ), | ||
| }, | ||
| last_seen={ | ||
| node_a: datetime.now(), | ||
| node_b: datetime.now(), | ||
| node_c: datetime.now(), | ||
| }, | ||
| node_identities={ | ||
| node_a: NodeIdentity(friendly_name="kite1"), | ||
| node_b: NodeIdentity(friendly_name="kite2"), | ||
| node_c: NodeIdentity(friendly_name="kite3"), | ||
| }, | ||
| ) | ||
|
|
||
| new_state = apply_node_timed_out(NodeTimedOut(node_id=node_a), state) | ||
|
|
||
| assert affected_instance_id not in new_state.instances | ||
| assert unaffected_instance_id in new_state.instances | ||
|
|
||
| assert affected_runner_a not in new_state.runners | ||
| assert affected_runner_b not in new_state.runners | ||
| assert unaffected_runner in new_state.runners | ||
|
|
||
| assert affected_task_id not in new_state.tasks | ||
| assert unaffected_task_id in new_state.tasks | ||
|
|
||
| assert node_a not in new_state.last_seen | ||
| assert node_b in new_state.last_seen | ||
| assert node_c in new_state.last_seen | ||
|
|
||
| assert node_a not in new_state.node_identities | ||
| assert node_b in new_state.node_identities | ||
| assert node_c in new_state.node_identities |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.