1
0
Fork 0

fix callback access

This commit is contained in:
Sean Sube 2024-01-04 19:39:44 -06:00
parent 9a1389d03b
commit 4dc251cf4a
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 13 additions and 8 deletions

View File

@ -140,9 +140,8 @@ class ChainPipeline:
callback = ChainProgress.from_progress(callback)
# set estimated totals
callback.set_total(
self.steps(params, sources.size), stages=len(self.stages), tiles=0
)
# TODO: should use self.steps, but size is not available here
callback.set_total(params.steps, stages=len(self.stages), tiles=0)
start = monotonic()

View File

@ -121,8 +121,8 @@ class WorkerContext:
# self.callback.step = step
self.set_progress(
step,
stages=self.callback.stage,
tiles=self.callback.tile,
stages=self.callback.stages.current,
tiles=self.callback.tiles.current,
)
self.callback = ChainProgress.from_progress(on_progress)
@ -144,8 +144,14 @@ class WorkerContext:
raise CancelledException("job has been cancelled")
result = None
total_steps = 0
total_stages = 0
total_tiles = 0
if self.callback is not None:
result = self.callback.result
total_steps = self.callback.steps.total
total_stages = self.callback.stages.total
total_tiles = self.callback.tiles.total
logger.debug("setting progress for job %s to %s", self.job, steps)
self.last_progress = ProgressCommand(
@ -153,9 +159,9 @@ class WorkerContext:
self.job_type,
self.device.device,
JobStatus.RUNNING,
steps=Progress(steps, self.callback.steps.total),
stages=Progress(stages, self.callback.stages.total),
tiles=Progress(tiles, self.callback.tiles.total),
steps=Progress(steps, total_steps),
stages=Progress(stages, total_stages),
tiles=Progress(tiles, total_tiles),
result=result,
)
self.progress.put(