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
a14a0365
Unverified
Commit
a14a0365
authored
Nov 28, 2024
by
Antoine Kaufmann
Browse files
experiments: add metadata in simulation object to json
parent
3084b579
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
experiments/simbricks/orchestration/simulation/base.py
experiments/simbricks/orchestration/simulation/base.py
+2
-1
No files found.
experiments/simbricks/orchestration/simulation/base.py
View file @
a14a0365
...
@@ -347,6 +347,7 @@ class Simulation(utils_base.IdObj):
...
@@ -347,6 +347,7 @@ class Simulation(utils_base.IdObj):
json_obj
[
"module"
]
=
self
.
__class__
.
__module__
json_obj
[
"module"
]
=
self
.
__class__
.
__module__
json_obj
[
"name"
]
=
self
.
name
json_obj
[
"name"
]
=
self
.
name
json_obj
[
"metadata"
]
=
self
.
metadata
json_obj
[
"system"
]
=
self
.
system
.
id
()
json_obj
[
"system"
]
=
self
.
system
.
id
()
json_obj
[
"timeout"
]
=
self
.
timeout
json_obj
[
"timeout"
]
=
self
.
timeout
...
@@ -383,7 +384,7 @@ class Simulation(utils_base.IdObj):
...
@@ -383,7 +384,7 @@ class Simulation(utils_base.IdObj):
@
classmethod
@
classmethod
def
fromJSON
(
cls
,
system
:
sys_conf
.
System
,
json_obj
:
dict
)
->
Simulation
:
def
fromJSON
(
cls
,
system
:
sys_conf
.
System
,
json_obj
:
dict
)
->
Simulation
:
instance
=
super
().
fromJSON
(
json_obj
)
instance
=
super
().
fromJSON
(
json_obj
)
instance
.
metadata
=
utils_base
.
get_json_attr_top
(
json_obj
,
"metadata"
)
instance
.
name
=
utils_base
.
get_json_attr_top
(
json_obj
,
"name"
)
instance
.
name
=
utils_base
.
get_json_attr_top
(
json_obj
,
"name"
)
system_id
=
int
(
utils_base
.
get_json_attr_top
(
json_obj
,
"system"
))
system_id
=
int
(
utils_base
.
get_json_attr_top
(
json_obj
,
"system"
))
assert
system_id
==
system
.
id
()
assert
system_id
==
system
.
id
()
...
...
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