diff options
author | siutin <osiutino@gmail.com> | 2023-04-17 03:50:08 +0000 |
---|---|---|
committer | siutin <osiutino@gmail.com> | 2023-04-17 05:53:41 +0000 |
commit | 3e5b3c79e49ec3a10174c250815dabce6efdddca (patch) | |
tree | c2564653bc4295159b0f18c87959ed8d47a0a4bf | |
parent | 984970068c2bdc14cff266129ca25a26fbccbf2e (diff) | |
download | stable-diffusion-webui-gfx803-3e5b3c79e49ec3a10174c250815dabce6efdddca.tar.gz stable-diffusion-webui-gfx803-3e5b3c79e49ec3a10174c250815dabce6efdddca.tar.bz2 stable-diffusion-webui-gfx803-3e5b3c79e49ec3a10174c250815dabce6efdddca.zip |
replace with #wrap_session_call
-rw-r--r-- | modules/call_queue.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/call_queue.py b/modules/call_queue.py index 632afcdd..43f6ebe0 100644 --- a/modules/call_queue.py +++ b/modules/call_queue.py @@ -10,6 +10,11 @@ from modules import shared, progress queue_lock = threading.Lock()
queue_lock_condition = threading.Condition(lock=queue_lock)
+def wrap_session_call(func):
+ def f(request: gr.Request, *args, **kwargs):
+ return func(request, *args, **kwargs)
+ return f
+
def wrap_queued_call(func):
def f(*args, **kwargs):
with queue_lock:
@@ -45,21 +50,18 @@ def wrap_gradio_gpu_call(func, extra_outputs=None): return res
- return wrap_gradio_call(f, extra_outputs=extra_outputs, add_stats=True, add_request=True)
+ return wrap_session_call(wrap_gradio_call(f, extra_outputs=extra_outputs, add_stats=True))
-def wrap_gradio_call(func, extra_outputs=None, add_stats=False, add_request=False):
- def f(request: gr.Request, *args, extra_outputs_array=extra_outputs, **kwargs):
+def wrap_gradio_call(func, extra_outputs=None, add_stats=False):
+ def f(*args, extra_outputs_array=extra_outputs, **kwargs):
run_memmon = shared.opts.memmon_poll_rate > 0 and not shared.mem_mon.disabled and add_stats
if run_memmon:
shared.mem_mon.monitor()
t = time.perf_counter()
try:
- if add_request:
- res = list(func(request, *args, **kwargs))
- else:
- res = list(func(*args, **kwargs))
+ 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
|