1
0
Fork 0

serialize metadata

This commit is contained in:
Sean Sube 2024-01-03 23:27:40 -06:00
parent 8ae6069ac3
commit bdefaec0d2
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
3 changed files with 7 additions and 7 deletions

View File

@ -270,7 +270,9 @@ class ChainPipeline:
len(stage_sources), len(stage_sources),
) )
callback.result = stage_sources # this has just been set to the result of the last stage callback.result = (
stage_sources # this has just been set to the result of the last stage
)
if is_debug(): if is_debug():
for j, image in enumerate(stage_sources.as_image()): for j, image in enumerate(stage_sources.as_image()):

View File

@ -138,7 +138,7 @@ def image_reply(
logger.error("metadata and outputs must be the same length") logger.error("metadata and outputs must be the same length")
return error_reply("metadata and outputs must be the same length") return error_reply("metadata and outputs must be the same length")
data["metadata"] = metadata data["metadata"] = [m.tojson() for m in metadata]
data["outputs"] = outputs data["outputs"] = outputs
return jsonify([data]) return jsonify([data])
@ -673,7 +673,7 @@ def job_status(server: ServerContext, pool: DevicePoolExecutor):
outputs = None outputs = None
metadata = None metadata = None
if progress.result is not None and len(progress.result) > 0: if progress.result is not None and len(progress.result) > 0:
# TODO: progress results should be a list of filenames and image metadata # TODO: the names should be attached to the result somehow rather than recomputing them
outputs = make_output_names(server, job_name, len(progress.result)) outputs = make_output_names(server, job_name, len(progress.result))
metadata = progress.result.metadata metadata = progress.result.metadata

View File

@ -121,9 +121,7 @@ class WorkerContext:
with self.idle.get_lock(): with self.idle.get_lock():
self.idle.value = idle self.idle.value = idle
def set_progress( def set_progress(self, steps: int, stages: int = 0, tiles: int = 0) -> None:
self, steps: int, stages: int = 0, tiles: int = 0
) -> None:
if self.job is None: if self.job is None:
raise RuntimeError("no job on which to set progress") raise RuntimeError("no job on which to set progress")