Unverified Commit e87e6bbc authored by Jakob Görgen's avatar Jakob Görgen
Browse files

symphony/client/simbricks/client/client: json to str in client

parent ea3bf8dd
...@@ -26,6 +26,7 @@ import typing ...@@ -26,6 +26,7 @@ import typing
import contextlib import contextlib
import asyncio import asyncio
import rich import rich
import json
from .auth import TokenProvider from .auth import TokenProvider
from .settings import client_settings from .settings import client_settings
from simbricks.orchestration import system from simbricks.orchestration import system
...@@ -246,7 +247,8 @@ class SimBricksClient: ...@@ -246,7 +247,8 @@ class SimBricksClient:
return await resp.json() return await resp.json()
async def create_system(self, system: system.System) -> dict: async def create_system(self, system: system.System) -> dict:
json_obj = {"sb_json": system.toJSON()} sys_json = json.dumps(system.toJSON())
json_obj = {"sb_json": sys_json}
async with self._ns_client.post(url="/systems", json=json_obj) as resp: async with self._ns_client.post(url="/systems", json=json_obj) as resp:
return await resp.json() return await resp.json()
...@@ -259,8 +261,8 @@ class SimBricksClient: ...@@ -259,8 +261,8 @@ class SimBricksClient:
return await resp.json() return await resp.json()
async def create_simulation(self, system_db_id: int, simulation: simulation.Simulation) -> simulation.Simulation: async def create_simulation(self, system_db_id: int, simulation: simulation.Simulation) -> simulation.Simulation:
json_obj = {"system_id": system_db_id, "sb_json": simulation.toJSON()} sim_js = json.dumps(simulation.toJSON())
print(json_obj) json_obj = {"system_id": system_db_id, "sb_json": sim_js}
async with self._ns_client.post(url="/simulations", json=json_obj) as resp: async with self._ns_client.post(url="/simulations", json=json_obj) as resp:
return await resp.json() return await resp.json()
...@@ -273,8 +275,8 @@ class SimBricksClient: ...@@ -273,8 +275,8 @@ class SimBricksClient:
return await resp.json() return await resp.json()
async def create_instantiation(self, sim_db_id: int, instantiation: simulation.Simulation) -> simulation.Simulation: async def create_instantiation(self, sim_db_id: int, instantiation: simulation.Simulation) -> simulation.Simulation:
json_obj = {"simulation_id": sim_db_id, "sb_json": {}} # FIXME inst_json = json.dumps({}) # FIXME
print(json_obj) json_obj = {"simulation_id": sim_db_id, "sb_json": inst_json}
async with self._ns_client.post(url="/instantiations", json=json_obj) as resp: async with self._ns_client.post(url="/instantiations", json=json_obj) as resp:
return await resp.json() return await resp.json()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment