Add protocol performance profiles
This commit is contained in:
@@ -561,3 +561,50 @@ def test_uploaded_source_is_preserved_in_meeting_directory(tmp_path: Path) -> No
|
||||
assert destination.parent == tmp_path / "meetings" / "meeting-1" / "uploads"
|
||||
assert destination.name.endswith("_unsafe.wav")
|
||||
assert destination.read_bytes() == b"source audio"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("profile", "threads"),
|
||||
[("fast", 16), ("efficient", 10), ("powersave", 4)],
|
||||
)
|
||||
def test_process_resolves_profile_for_protocol_generation(
|
||||
tmp_path: Path, profile: str, threads: int
|
||||
) -> None:
|
||||
service, gateway = make_service(tmp_path)
|
||||
audio = tmp_path / "meeting.wav"
|
||||
audio.write_bytes(b"audio")
|
||||
|
||||
service.process(
|
||||
audio,
|
||||
meeting(),
|
||||
participants(),
|
||||
ProcessingOptions(performance_profile=profile),
|
||||
)
|
||||
|
||||
assert gateway.config_values is not None
|
||||
assert gateway.config_values["protocol_num_thread"] == threads
|
||||
|
||||
|
||||
def test_process_defaults_to_backend_thread_selection(tmp_path: Path) -> None:
|
||||
service, gateway = make_service(tmp_path)
|
||||
audio = tmp_path / "meeting.wav"
|
||||
audio.write_bytes(b"audio")
|
||||
|
||||
service.process(audio, meeting(), participants(), ProcessingOptions())
|
||||
|
||||
assert gateway.config_values is not None
|
||||
assert gateway.config_values["protocol_num_thread"] is None
|
||||
|
||||
|
||||
def test_protocol_regeneration_propagates_explicit_profile(tmp_path: Path) -> None:
|
||||
service, gateway = make_service(tmp_path)
|
||||
write_speaker_review_artifacts(gateway.run_dir)
|
||||
|
||||
service.regenerate_protocol(
|
||||
gateway.run_dir,
|
||||
{},
|
||||
performance_profile="fast",
|
||||
)
|
||||
|
||||
assert gateway.regeneration is not None
|
||||
assert gateway.regeneration["options"]["protocol_num_thread"] == 16
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import pytest
|
||||
|
||||
from mka.application.meeting_service import ProcessingOptions
|
||||
from mka.application.performance import PERFORMANCE_PROFILES, resolve_ollama_num_thread
|
||||
|
||||
|
||||
def test_default_profile_is_auto() -> None:
|
||||
assert ProcessingOptions().performance_profile == "auto"
|
||||
assert PERFORMANCE_PROFILES[0] == "auto"
|
||||
|
||||
|
||||
def test_auto_profile_has_no_ollama_thread_override() -> None:
|
||||
assert resolve_ollama_num_thread("auto") is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("profile", "threads"),
|
||||
[("fast", 16), ("efficient", 10), ("powersave", 4)],
|
||||
)
|
||||
def test_profiles_resolve_to_current_ollama_thread_counts(profile: str, threads: int) -> None:
|
||||
assert resolve_ollama_num_thread(profile) == threads
|
||||
Reference in New Issue
Block a user