Skip to content

Commit

Permalink
fixing bug cp_mapper by unpacking threads from attributes_from_cpu_name
Browse files Browse the repository at this point in the history
  • Loading branch information
da-ekchajzer committed Jan 23, 2024
1 parent 806f6ee commit 7603978
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boaviztapi/dto/consumption_profile/consumption_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def mapper_cp_cpu(cp_dto: ConsumptionProfileCPU) -> Tuple[CPUConsumptionProfileM
manufacturer, model_range, family = None, None, None

if cp_dto.cpu.name is not None:
name, manufacturer, family, model_range, tdp, cores, total_die_size, total_die_size_source, source = attributes_from_cpu_name(cp_dto.cpu.name)
name, manufacturer, family, model_range, tdp, cores, threads, die_size, die_size_source, source = attributes_from_cpu_name(cp_dto.cpu.name)

if cp_dto.cpu.manufacturer is not None:
cpu.manufacturer.set_input(cp_dto.cpu.manufacturer)
Expand Down
14 changes: 14 additions & 0 deletions tests/api/test_cp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest
from httpx import AsyncClient

from boaviztapi.main import app

pytest_plugins = ('pytest_asyncio',)


@pytest.mark.asyncio
async def test_complete_cpu():
async with AsyncClient(app=app, base_url="http://test") as ac:
res = await ac.post('/v1/consumption_profile/cpu', json={"cpu": {"name": "intel xeon gold 6134", "tdp": 130}})

assert res.json() == {'a': 35.5688, 'b': 0.2438, 'c': 9.6694, 'd': -0.6087}

0 comments on commit 7603978

Please sign in to comment.