Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
d52ed407
"web/git@developer.sourcefind.cn:chenpangpang/ComfyUI.git" did not exist on "b2f03164c727d2252ac8509361082ba88481cfb1"
Commit
d52ed407
authored
Jun 13, 2023
by
comfyanonymous
Browse files
Send websocket message only when prompt is actually done executing.
parent
ff9b22d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
execution.py
execution.py
+0
-6
main.py
main.py
+11
-2
No files found.
execution.py
View file @
d52ed407
...
...
@@ -310,7 +310,6 @@ class PromptExecutor:
else
:
self
.
server
.
client_id
=
None
execution_start_time
=
time
.
perf_counter
()
if
self
.
server
.
client_id
is
not
None
:
self
.
server
.
send_sync
(
"execution_start"
,
{
"prompt_id"
:
prompt_id
},
self
.
server
.
client_id
)
...
...
@@ -358,12 +357,7 @@ class PromptExecutor:
for
x
in
executed
:
self
.
old_prompt
[
x
]
=
copy
.
deepcopy
(
prompt
[
x
])
self
.
server
.
last_node_id
=
None
if
self
.
server
.
client_id
is
not
None
:
self
.
server
.
send_sync
(
"executing"
,
{
"node"
:
None
,
"prompt_id"
:
prompt_id
},
self
.
server
.
client_id
)
print
(
"Prompt executed in {:.2f} seconds"
.
format
(
time
.
perf_counter
()
-
execution_start_time
))
gc
.
collect
()
comfy
.
model_management
.
soft_empty_cache
()
def
validate_inputs
(
prompt
,
item
,
validated
):
...
...
main.py
View file @
d52ed407
...
...
@@ -3,6 +3,8 @@ import itertools
import
os
import
shutil
import
threading
import
gc
import
time
from
comfy.cli_args
import
args
import
comfy.utils
...
...
@@ -28,15 +30,22 @@ import folder_paths
import
server
from
server
import
BinaryEventTypes
from
nodes
import
init_custom_nodes
import
comfy.model_management
def
prompt_worker
(
q
,
server
):
e
=
execution
.
PromptExecutor
(
server
)
while
True
:
item
,
item_id
=
q
.
get
()
e
.
execute
(
item
[
2
],
item
[
1
],
item
[
3
],
item
[
4
])
execution_start_time
=
time
.
perf_counter
()
prompt_id
=
item
[
1
]
e
.
execute
(
item
[
2
],
prompt_id
,
item
[
3
],
item
[
4
])
q
.
task_done
(
item_id
,
e
.
outputs_ui
)
if
server
.
client_id
is
not
None
:
server
.
send_sync
(
"executing"
,
{
"node"
:
None
,
"prompt_id"
:
prompt_id
},
server
.
client_id
)
print
(
"Prompt executed in {:.2f} seconds"
.
format
(
time
.
perf_counter
()
-
execution_start_time
))
gc
.
collect
()
comfy
.
model_management
.
soft_empty_cache
()
async
def
run
(
server
,
address
=
''
,
port
=
8188
,
verbose
=
True
,
call_on_start
=
None
):
await
asyncio
.
gather
(
server
.
start
(
address
,
port
,
verbose
,
call_on_start
),
server
.
publish_loop
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment