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) callback = ChainProgress.from_progress(callback)
# set estimated totals # set estimated totals
callback.set_total( # TODO: should use self.steps, but size is not available here
self.steps(params, sources.size), stages=len(self.stages), tiles=0 callback.set_total(params.steps, stages=len(self.stages), tiles=0)
)
start = monotonic() start = monotonic()

View File

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