Skip to content

Commit 66759a5

Browse files
fix(ci): ruff whitespace, undefined _VALID_ACTIONS, stale tier-map tests (#620)
- Auto-fix 12 trailing whitespace (W291) + 1 missing newline (W292) in assign_gpus.py and test-assign-gpus.py - Define _VALID_ACTIONS set in updates.py (was F821 undefined name) - Update tier-map.bats: qwen3-8b → qwen3.5-9b (tier 1/2), qwen3-14b → qwen3.5-27b (tier 3), matching current tier-map.sh Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f2d0c44 commit 66759a5

4 files changed

Lines changed: 29 additions & 27 deletions

File tree

dream-server/extensions/services/dashboard-api/routers/updates.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
router = APIRouter(tags=["updates"])
2020

21+
_VALID_ACTIONS = {"check", "backup", "update"}
22+
2123
_GITHUB_HEADERS = {"Accept": "application/vnd.github.v3+json"}
2224

2325

dream-server/scripts/assign_gpus.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
from typing import Optional
2020

2121

22-
# Constants
22+
# Constants
2323

2424
HIGH_BW_THRESHOLD = 80 # min rank for NVLink / XGMI
2525
DEFAULT_SERVICES = ["llama_server", "whisper", "comfyui", "embeddings"]
2626
NON_LLAMA = ["whisper", "comfyui", "embeddings"]
2727

2828

29-
# Data Models
29+
# Data Models
3030

3131
@dataclass
3232
class GPU:
@@ -69,7 +69,7 @@ class AssignmentResult:
6969
services: dict
7070

7171

72-
# Phase 1: Topology Analysis
72+
# Phase 1: Topology Analysis
7373

7474
def parse_gpus(topology: dict) -> list:
7575
gpus = []
@@ -156,7 +156,7 @@ def enumerate_subsets(gpus: list, rank_matrix: dict) -> list:
156156
)
157157

158158

159-
# Phase 2: GPU Assignment
159+
# Phase 2: GPU Assignment
160160

161161
def find_llama_subset(ordered_subsets: list, model_size_mb: float) -> Subset:
162162
"""
@@ -257,7 +257,7 @@ def assign_services(all_gpus: list, llama_gpus: list, rank_matrix: dict, enabled
257257
return assignments, final_llama_gpus, strategy
258258

259259

260-
# Phase 3: Llama Parallelism
260+
# Phase 3: Llama Parallelism
261261

262262
def largest_pow2_divisor(n: int) -> int:
263263
"""
@@ -369,7 +369,7 @@ def select_parallelism(subset: Subset) -> LlamaParallelism:
369369
)
370370

371371

372-
# Phase 4: Build Output JSON
372+
# Phase 4: Build Output JSON
373373

374374
def build_output(result: AssignmentResult) -> dict:
375375
services = {}
@@ -400,7 +400,7 @@ def build_output(result: AssignmentResult) -> dict:
400400
}
401401

402402

403-
# Entry Point
403+
# Entry Point
404404

405405
def main():
406406
parser = argparse.ArgumentParser(description="GPU assignment algorithm for DreamServer")
@@ -429,7 +429,7 @@ def main():
429429
print("ERROR: no GPUs found in topology", file=sys.stderr)
430430
sys.exit(1)
431431

432-
# Early exit: single GPU
432+
# Early exit: single GPU
433433
if gpu_count == 1:
434434
gpu = parse_gpus(topology)[0]
435435
if model_size_mb > gpu.memory_mb:
@@ -453,13 +453,13 @@ def main():
453453
print(json.dumps(build_output(result), indent=2))
454454
return
455455

456-
# Phase 1: Topology analysis
456+
# Phase 1: Topology analysis
457457
gpus = parse_gpus(topology)
458458
links = parse_links(topology)
459459
rank_matrix = build_rank_matrix(links)
460460
ordered = enumerate_subsets(gpus, rank_matrix)
461461

462-
# Phase 2: GPU assignment
462+
# Phase 2: GPU assignment
463463
try:
464464
llama_subset = find_llama_subset(ordered, model_size_mb)
465465
if llama_subset is None:
@@ -472,12 +472,12 @@ def main():
472472
gpus, llama_subset.gpus, rank_matrix, enabled_services
473473
)
474474

475-
# Phase 3: Llama parallelism
475+
# Phase 3: Llama parallelism
476476
final_subset = compute_subset(final_llama_gpus, rank_matrix)
477477
parallelism = select_parallelism(final_subset)
478478
service_assignments["llama_server"].parallelism = parallelism
479479

480-
# Phase 4: Emit JSON
480+
# Phase 4: Emit JSON
481481
result = AssignmentResult(strategy=strategy, services=service_assignments)
482482
print(json.dumps(build_output(result), indent=2))
483483

dream-server/tests/bats-tests/tier-map.bats

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,29 @@ setup() {
2020

2121
# ── resolve_tier_config ─────────────────────────────────────────────────────
2222

23-
@test "resolve_tier_config: tier 1 sets Entry Level with qwen3-8b" {
23+
@test "resolve_tier_config: tier 1 sets Entry Level with qwen3.5-9b" {
2424
TIER=1
2525
resolve_tier_config
2626
assert_equal "$TIER_NAME" "Entry Level"
27-
assert_equal "$LLM_MODEL" "qwen3-8b"
28-
assert_equal "$GGUF_FILE" "Qwen3-8B-Q4_K_M.gguf"
27+
assert_equal "$LLM_MODEL" "qwen3.5-9b"
28+
assert_equal "$GGUF_FILE" "Qwen3.5-9B-Q4_K_M.gguf"
2929
assert_equal "$MAX_CONTEXT" "16384"
3030
}
3131

32-
@test "resolve_tier_config: tier 2 sets Prosumer with qwen3-8b" {
32+
@test "resolve_tier_config: tier 2 sets Prosumer with qwen3.5-9b" {
3333
TIER=2
3434
resolve_tier_config
3535
assert_equal "$TIER_NAME" "Prosumer"
36-
assert_equal "$LLM_MODEL" "qwen3-8b"
36+
assert_equal "$LLM_MODEL" "qwen3.5-9b"
3737
assert_equal "$MAX_CONTEXT" "32768"
3838
}
3939

40-
@test "resolve_tier_config: tier 3 sets Pro with qwen3-14b" {
40+
@test "resolve_tier_config: tier 3 sets Pro with qwen3.5-27b" {
4141
TIER=3
4242
resolve_tier_config
4343
assert_equal "$TIER_NAME" "Pro"
44-
assert_equal "$LLM_MODEL" "qwen3-14b"
45-
assert_equal "$GGUF_FILE" "Qwen3-14B-Q4_K_M.gguf"
44+
assert_equal "$LLM_MODEL" "qwen3.5-27b"
45+
assert_equal "$GGUF_FILE" "Qwen3.5-27B-Q4_K_M.gguf"
4646
assert_equal "$MAX_CONTEXT" "32768"
4747
}
4848

@@ -101,27 +101,27 @@ setup() {
101101

102102
@test "tier_to_model: maps all numeric tiers correctly" {
103103
run tier_to_model 1
104-
assert_output "qwen3-8b"
104+
assert_output "qwen3.5-9b"
105105

106106
run tier_to_model 2
107-
assert_output "qwen3-8b"
107+
assert_output "qwen3.5-9b"
108108

109109
run tier_to_model 3
110-
assert_output "qwen3-14b"
110+
assert_output "qwen3.5-27b"
111111

112112
run tier_to_model 4
113113
assert_output "qwen3-30b-a3b"
114114
}
115115

116116
@test "tier_to_model: maps T-prefix aliases correctly" {
117117
run tier_to_model T1
118-
assert_output "qwen3-8b"
118+
assert_output "qwen3.5-9b"
119119

120120
run tier_to_model T2
121-
assert_output "qwen3-8b"
121+
assert_output "qwen3.5-9b"
122122

123123
run tier_to_model T3
124-
assert_output "qwen3-14b"
124+
assert_output "qwen3.5-27b"
125125

126126
run tier_to_model T4
127127
assert_output "qwen3-30b-a3b"

dream-server/tests/test-assign-gpus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,4 +557,4 @@ def test_mem_util_hybrid_is_093(self):
557557

558558
def test_mem_util_pipeline_is_095(self):
559559
_, out, _ = run(fixture_path("nvidia_smi_topo_matrix_4gpus_soc.json"), 100000)
560-
assert parallelism(out)["gpu_memory_utilization"] == 0.95
560+
assert parallelism(out)["gpu_memory_utilization"] == 0.95

0 commit comments

Comments
 (0)