1
0
Fork 0

fix(api): exit worker on memory allocation errors

This commit is contained in:
Sean Sube 2023-03-05 21:07:06 -06:00
parent cb460a0c59
commit 57fed94337
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 10 additions and 6 deletions

View File

@ -39,10 +39,14 @@ def worker_main(context: WorkerContext, server: ServerContext):
logger.info("worker got keyboard interrupt")
exit(0)
except ValueError as e:
logger.info("value error in worker: %s", e)
logger.info("value error in worker, exiting: %s", e)
exit(1)
except Exception as e:
logger.error(
"error while running job: %s",
format_exception(type(e), e, e.__traceback__),
)
if "Failed to allocate memory" in str(e):
logger.error("detected out-of-memory error, exiting: %s", e)
exit(2)
else:
logger.error(
"error while running job: %s",
format_exception(type(e), e, e.__traceback__),
)

View File

@ -6,7 +6,7 @@ do
curl "${test_host}/api/txt2img?"\
'cfg=16.00&steps=30&scheduler=ddim&seed=-1&'\
'prompt=an+astronaut+eating+a+hamburger&negativePrompt=&'\
'model=stable-diffusion-onnx-v1-5&platform=any&'\
'model=stable-diffusion-onnx-v1-5&platform=cuda&'\
'upscaling=upscaling-real-esrgan-x2-plus&correction=correction-codeformer&'\
'lpw=false&width=512&height=512&upscaleOrder=correction-both' \
-X 'POST' \