Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
e87e6bbc
Unverified
Commit
e87e6bbc
authored
Dec 09, 2024
by
Jakob Görgen
Browse files
symphony/client/simbricks/client/client: json to str in client
parent
ea3bf8dd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
symphony/client/simbricks/client/client.py
symphony/client/simbricks/client/client.py
+7
-5
No files found.
symphony/client/simbricks/client/client.py
View file @
e87e6bbc
...
...
@@ -26,6 +26,7 @@ import typing
import
contextlib
import
asyncio
import
rich
import
json
from
.auth
import
TokenProvider
from
.settings
import
client_settings
from
simbricks.orchestration
import
system
...
...
@@ -246,7 +247,8 @@ class SimBricksClient:
return
await
resp
.
json
()
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
:
return
await
resp
.
json
()
...
...
@@ -259,8 +261,8 @@ class SimBricksClient:
return
await
resp
.
json
()
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
()
}
print
(
json_obj
)
sim_js
=
json
.
dumps
(
simulation
.
toJSON
()
)
json_obj
=
{
"system_id"
:
system_db_id
,
"sb_json"
:
sim_js
}
async
with
self
.
_ns_client
.
post
(
url
=
"/simulations"
,
json
=
json_obj
)
as
resp
:
return
await
resp
.
json
()
...
...
@@ -273,8 +275,8 @@ class SimBricksClient:
return
await
resp
.
json
()
async
def
create_instantiation
(
self
,
sim_db_id
:
int
,
instantiation
:
simulation
.
Simulation
)
->
simulation
.
Simulation
:
json_obj
=
{
"simulation_id"
:
sim_db_id
,
"sb_json"
:
{}}
# FIXME
print
(
json_obj
)
inst_json
=
json
.
dumps
({})
# FIXME
json_obj
=
{
"simulation_id"
:
sim_db_id
,
"sb_json"
:
inst_json
}
async
with
self
.
_ns_client
.
post
(
url
=
"/instantiations"
,
json
=
json_obj
)
as
resp
:
return
await
resp
.
json
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment