Skip to content

Commit 046e784

Browse files
committed
🐛 Fix use of msgpack for grid metrics
1 parent c9af135 commit 046e784

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

simvue/api/objects/grids.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99

1010
import http
11+
import msgpack
1112
import numpy
1213
import typing
1314

@@ -373,8 +374,9 @@ def _log_values(self, metrics: list[GridMetricSet]) -> None:
373374

374375
_response = sv_post(
375376
url=f"{self._user_config.server.url}/{self.run_grids_endpoint(self._run_id)}",
376-
headers=self._headers,
377-
data=metrics,
377+
headers=self._headers | {"Content-Type": "application/msgpack"},
378+
data=msgpack.packb(metrics, use_bin_type=True),
379+
is_json=False,
378380
params={},
379381
)
380382

tests/unit/test_grids.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_grid_creation_online() -> None:
4747

4848
@pytest.mark.api
4949
@pytest.mark.offline
50-
def test_grid_creation_offline() -> None:
50+
def test_grid_creation_offline(offline_cache_setup) -> None:
5151
_uuid: str = f"{uuid.uuid4()}".split("-")[0]
5252
_folder_name = f"/simvue_unit_testing/{_uuid}"
5353
_folder = Folder.new(path=_folder_name, offline=True)
@@ -141,7 +141,7 @@ def test_grid_metrics_creation_online() -> None:
141141

142142
@pytest.mark.api
143143
@pytest.mark.offline
144-
def test_grid_metrics_creation_offline() -> None:
144+
def test_grid_metrics_creation_offline(offline_cache_setup) -> None:
145145
_uuid: str = f"{uuid.uuid4()}".split("-")[0]
146146
_folder_name = f"/simvue_unit_testing/{_uuid}"
147147
_folder = Folder.new(path=_folder_name, offline=True)

0 commit comments

Comments
 (0)