Skip to content

Commit

Permalink
fix(api): log stacktrace from job errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Feb 5, 2023
1 parent e059f11 commit bf1378b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
8 changes: 1 addition & 7 deletions api/onnx_web/chain/correct_codeformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ def correct_codeformer(
source_image: Image.Image,
**kwargs,
) -> Image.Image:
pipe = CodeFormer(
dim_embd=512,
codebook_size=1024,
n_head=8,
n_layers=9,
connect_list=["32", "64", "128", "256"],
).to(device)
pipe = CodeFormer().to(device)

return pipe(source_image)
3 changes: 2 additions & 1 deletion api/onnx_web/device_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from concurrent.futures import Future, ProcessPoolExecutor, ThreadPoolExecutor
from logging import getLogger
from multiprocessing import Value
from traceback import format_exception
from typing import Any, Callable, List, Optional, Tuple, Union

from .params import DeviceParams
Expand Down Expand Up @@ -191,7 +192,7 @@ def job_done(f: Future):
f.result()
logger.info("job %s finished successfully", key)
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)

Expand Down
16 changes: 16 additions & 0 deletions common/pipelines/codeformer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"stages": [
{
"name": "faces",
"type": "correct-codeformer",
"params": {}
},
{
"name": "save-local",
"type": "persist-disk",
"params": {
"tile_size": "hd8k"
}
}
]
}

0 comments on commit bf1378b

Please sign in to comment.