aboutsummaryrefslogtreecommitdiff
path: root/modules/call_queue.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-06-27 09:05:53 +0300
committerGitHub <noreply@github.com>2023-06-27 09:05:53 +0300
commit4147fd6b2f905f76c6bc20c3d9de2ea0842fa853 (patch)
treee7915af4d068912cd8509f1638e05460445a5eea /modules/call_queue.py
parentf603275d84301b5ee952683e951dd1aad72ba615 (diff)
parentbedcd2f377a38ef4da58c11dbe222d32b954be2f (diff)
Merge branch 'dev' into 10141-gradio-user-exif
Diffstat (limited to 'modules/call_queue.py')
-rw-r--r--modules/call_queue.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/modules/call_queue.py b/modules/call_queue.py
index 64ebf868..69bf63d2 100644
--- a/modules/call_queue.py
+++ b/modules/call_queue.py
@@ -1,11 +1,9 @@
from functools import wraps
import html
-import sys
import threading
-import traceback
import time
-from modules import shared, progress
+from modules import shared, progress, errors
queue_lock = threading.Lock()
@@ -25,7 +23,7 @@ def wrap_gradio_gpu_call(func, extra_outputs=None):
def f(*args, **kwargs):
# if the first argument is a string that says "task(...)", it is treated as a job id
- if len(args) > 0 and type(args[0]) == str and args[0][0:5] == "task(" and args[0][-1] == ")":
+ if args and type(args[0]) == str and args[0].startswith("task(") and args[0].endswith(")"):
id_task = args[0]
progress.add_task_to_queue(id_task)
else:
@@ -59,16 +57,14 @@ def wrap_gradio_call(func, extra_outputs=None, add_stats=False):
try:
res = list(func(*args, **kwargs))
except Exception as e:
- # When printing out our debug argument list, do not print out more than a MB of text
- max_debug_str_len = 131072 # (1024*1024)/8
-
- print("Error completing request", file=sys.stderr)
- argStr = f"Arguments: {args} {kwargs}"
- print(argStr[:max_debug_str_len], file=sys.stderr)
- if len(argStr) > max_debug_str_len:
- print(f"(Argument list truncated at {max_debug_str_len}/{len(argStr)} characters)", file=sys.stderr)
-
- print(traceback.format_exc(), file=sys.stderr)
+ # When printing out our debug argument list,
+ # do not print out more than a 100 KB of text
+ max_debug_str_len = 131072
+ message = "Error completing request"
+ arg_str = f"Arguments: {args} {kwargs}"[:max_debug_str_len]
+ if len(arg_str) > max_debug_str_len:
+ arg_str += f" (Argument list truncated at {max_debug_str_len}/{len(arg_str)} characters)"
+ errors.report(f"{message}\n{arg_str}", exc_info=True)
shared.state.job = ""
shared.state.job_count = 0
@@ -111,4 +107,3 @@ def wrap_gradio_call(func, extra_outputs=None, add_stats=False):
return tuple(res)
return f
-