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
f9943b68
Unverified
Commit
f9943b68
authored
Jan 21, 2025
by
Jakob Görgen
Browse files
symphony/orchestration: more properties serialization + deserialization instantiation
parent
bf5c4aff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
symphony/orchestration/simbricks/orchestration/instantiation/base.py
...chestration/simbricks/orchestration/instantiation/base.py
+21
-0
No files found.
symphony/orchestration/simbricks/orchestration/instantiation/base.py
View file @
f9943b68
...
...
@@ -107,6 +107,8 @@ class Instantiation(util_base.IdObj):
def
toJSON
(
self
)
->
dict
:
json_obj
=
super
().
toJSON
()
if
self
.
runner_label
:
json_obj
[
"runner_label"
]
=
self
.
runner_label
json_obj
[
"simulation"
]
=
self
.
simulation
.
id
()
...
...
@@ -124,6 +126,11 @@ class Instantiation(util_base.IdObj):
json_obj
[
"artifact_name"
]
=
self
.
artifact_name
json_obj
[
"artifact_paths"
]
=
self
.
artifact_paths
json_obj
[
"create_checkpoint"
]
=
self
.
_create_checkpoint
json_obj
[
"restore_checkpoint"
]
=
self
.
_restore_checkpoint
json_obj
[
"preserve_checkpoints"
]
=
self
.
_preserve_checkpoints
json_obj
[
"preserve_tmp_folder"
]
=
self
.
preserve_tmp_folder
# TODO: serialize other fields etc. of interest
return
json_obj
...
...
@@ -131,6 +138,8 @@ class Instantiation(util_base.IdObj):
def
fromJSON
(
cls
,
sim
:
sim_base
.
Simulation
,
json_obj
:
dict
)
->
Instantiation
:
instance
=
super
().
fromJSON
(
json_obj
)
instance
.
runner_label
=
util_base
.
get_json_attr_top_or_none
(
json_obj
,
"runner_label"
)
simulation_id
=
int
(
util_base
.
get_json_attr_top
(
json_obj
,
"simulation"
))
assert
simulation_id
==
sim
.
id
()
instance
.
simulation
=
sim
...
...
@@ -146,6 +155,18 @@ class Instantiation(util_base.IdObj):
instance
.
artifact_name
=
util_base
.
get_json_attr_top
(
json_obj
,
"artifact_name"
)
instance
.
artifact_paths
=
util_base
.
get_json_attr_top
(
json_obj
,
"artifact_paths"
)
instance
.
_create_checkpoint
=
bool
(
util_base
.
get_json_attr_top
(
json_obj
,
"create_checkpoint"
)
)
instance
.
_restore_checkpoint
=
bool
(
util_base
.
get_json_attr_top
(
json_obj
,
"restore_checkpoint"
)
)
instance
.
_preserve_checkpoints
=
bool
(
util_base
.
get_json_attr_top
(
json_obj
,
"preserve_checkpoints"
)
)
instance
.
preserve_tmp_folder
=
bool
(
util_base
.
get_json_attr_top
(
json_obj
,
"preserve_tmp_folder"
)
)
# TODO: deserialize other fields etc. of interest
return
instance
...
...
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