Skip to content

Commit

Permalink
fix(api): only remove one retry after each tile failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Sep 13, 2023
1 parent 07bea84 commit e7aad28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pip-dev: check-venv

test:
python -m coverage erase
python -m coverage run -m unittest discover -s tests/
python -m coverage run -m unittest discover -v -s tests/
python -m coverage html -i
python -m coverage xml -i

Expand Down
8 changes: 4 additions & 4 deletions api/onnx_web/chain/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def stage_tile(
tile_mask: Image.Image,
dims: Tuple[int, int, int],
) -> Image.Image:
for i in range(worker.retries):
for _i in range(worker.retries):
try:
output_tile = stage_pipe.run(
worker,
Expand All @@ -201,13 +201,13 @@ def stage_tile(

return output_tile[0]
except Exception:
worker.retries = worker.retries - 1
logger.exception(
"error while running stage pipeline for tile, retry %s of 3",
i,
"error while running stage pipeline for tile, %s retries left",
worker.retries,
)
server.cache.clear()
run_gc([worker.get_device()])
worker.retries = worker.retries - (i + 1)

raise RetryException("exhausted retries on tile")

Expand Down

0 comments on commit e7aad28

Please sign in to comment.