1
0
Fork 0

fix(api): log stacktrace from job errors

This commit is contained in:
Sean Sube 2023-02-05 08:50:26 -06:00
parent e059f11253
commit bf1378bf96
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
3 changed files with 19 additions and 8 deletions

View File

@ -24,12 +24,6 @@ def correct_codeformer(
source_image: Image.Image, source_image: Image.Image,
**kwargs, **kwargs,
) -> Image.Image: ) -> Image.Image:
pipe = CodeFormer( pipe = CodeFormer().to(device)
dim_embd=512,
codebook_size=1024,
n_head=8,
n_layers=9,
connect_list=["32", "64", "128", "256"],
).to(device)
return pipe(source_image) return pipe(source_image)

View File

@ -2,6 +2,7 @@ from collections import Counter
from concurrent.futures import Future, ProcessPoolExecutor, ThreadPoolExecutor from concurrent.futures import Future, ProcessPoolExecutor, ThreadPoolExecutor
from logging import getLogger from logging import getLogger
from multiprocessing import Value from multiprocessing import Value
from traceback import format_exception
from typing import Any, Callable, List, Optional, Tuple, Union from typing import Any, Callable, List, Optional, Tuple, Union
from .params import DeviceParams from .params import DeviceParams
@ -191,7 +192,7 @@ class DevicePoolExecutor:
f.result() f.result()
logger.info("job %s finished successfully", key) logger.info("job %s finished successfully", key)
except Exception as err: except Exception as err:
logger.warn("job %s failed with an error: %s", key, err) logger.warn("job %s failed with an error: %s", key, format_exception(type(err), err, err.__traceback__))
future.add_done_callback(job_done) future.add_done_callback(job_done)

View File

@ -0,0 +1,16 @@
{
"stages": [
{
"name": "faces",
"type": "correct-codeformer",
"params": {}
},
{
"name": "save-local",
"type": "persist-disk",
"params": {
"tile_size": "hd8k"
}
}
]
}