"git@developer.sourcefind.cn:modelzoo/resnet50_tensorflow.git" did not exist on "5b60084d20541f3dc937222360edb443e12d9641"
Unverified Commit f9943b68 authored by Jakob Görgen's avatar Jakob Görgen
Browse files

symphony/orchestration: more properties serialization + deserialization instantiation

parent bf5c4aff
...@@ -107,6 +107,8 @@ class Instantiation(util_base.IdObj): ...@@ -107,6 +107,8 @@ class Instantiation(util_base.IdObj):
def toJSON(self) -> dict: def toJSON(self) -> dict:
json_obj = super().toJSON() json_obj = super().toJSON()
if self.runner_label:
json_obj["runner_label"] = self.runner_label
json_obj["simulation"] = self.simulation.id() json_obj["simulation"] = self.simulation.id()
...@@ -124,6 +126,11 @@ class Instantiation(util_base.IdObj): ...@@ -124,6 +126,11 @@ class Instantiation(util_base.IdObj):
json_obj["artifact_name"] = self.artifact_name json_obj["artifact_name"] = self.artifact_name
json_obj["artifact_paths"] = self.artifact_paths 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 # TODO: serialize other fields etc. of interest
return json_obj return json_obj
...@@ -131,6 +138,8 @@ class Instantiation(util_base.IdObj): ...@@ -131,6 +138,8 @@ class Instantiation(util_base.IdObj):
def fromJSON(cls, sim: sim_base.Simulation, json_obj: dict) -> Instantiation: def fromJSON(cls, sim: sim_base.Simulation, json_obj: dict) -> Instantiation:
instance = super().fromJSON(json_obj) 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")) simulation_id = int(util_base.get_json_attr_top(json_obj, "simulation"))
assert simulation_id == sim.id() assert simulation_id == sim.id()
instance.simulation = sim instance.simulation = sim
...@@ -146,6 +155,18 @@ class Instantiation(util_base.IdObj): ...@@ -146,6 +155,18 @@ class Instantiation(util_base.IdObj):
instance.artifact_name = util_base.get_json_attr_top(json_obj, "artifact_name") 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.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 # TODO: deserialize other fields etc. of interest
return instance return instance
......
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