Merge 03b8cea1dfc915c691d85776080fe161204b58cc into de17a9755ecb8419cb167fe8504791df5b07246f

This commit is contained in:
Ryu Xin 2024-08-06 11:12:24 -04:00 committed by GitHub
commit 7f4fb088e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 2 deletions

View File

@ -140,9 +140,9 @@ def recursive_execute(server, prompt, outputs, current_item, extra_data, execute
input_data_all = None input_data_all = None
try: try:
input_data_all = get_input_data(inputs, class_def, unique_id, outputs, prompt, extra_data) input_data_all = get_input_data(inputs, class_def, unique_id, outputs, prompt, extra_data)
server.last_node_id = unique_id
if server.client_id is not None: if server.client_id is not None:
server.last_node_id = unique_id server.send_sync("executing", {"node": unique_id, "prompt_id": prompt_id}, server.client_id)
server.send_sync("executing", { "node": unique_id, "prompt_id": prompt_id }, server.client_id)
obj = object_storage.get((unique_id, class_type), None) obj = object_storage.get((unique_id, class_type), None)
if obj is None: if obj is None:

View File

@ -1975,6 +1975,8 @@ def init_external_custom_nodes():
node_paths = folder_paths.get_folder_paths("custom_nodes") node_paths = folder_paths.get_folder_paths("custom_nodes")
node_import_times = [] node_import_times = []
for custom_node_path in node_paths: for custom_node_path in node_paths:
if not os.path.exists(custom_node_path):
continue
possible_modules = os.listdir(os.path.realpath(custom_node_path)) possible_modules = os.listdir(os.path.realpath(custom_node_path))
if "__pycache__" in possible_modules: if "__pycache__" in possible_modules:
possible_modules.remove("__pycache__") possible_modules.remove("__pycache__")

View File

@ -470,6 +470,23 @@ class PromptServer():
prompt_id = request.match_info.get("prompt_id", None) prompt_id = request.match_info.get("prompt_id", None)
return web.json_response(self.prompt_queue.get_history(prompt_id=prompt_id)) return web.json_response(self.prompt_queue.get_history(prompt_id=prompt_id))
@routes.get("/output/{prompt_id}")
async def get_output_id(request):
str = request.match_info.get("prompt_id", None)
output = {}
if str is None:
return web.json_response(output)
prompt_ids = str.split(",")
for prompt_id in prompt_ids:
the_result = self.prompt_queue.get_history(prompt_id=prompt_id)
if len(the_result) == 0:
return web.json_response(output)
result_info = {'outputs': the_result[prompt_id]['outputs']}
output[prompt_id] = result_info
return web.json_response(output)
@routes.get("/queue") @routes.get("/queue")
async def get_queue(request): async def get_queue(request):
queue_info = {} queue_info = {}
@ -478,6 +495,29 @@ class PromptServer():
queue_info['queue_pending'] = current_queue[1] queue_info['queue_pending'] = current_queue[1]
return web.json_response(queue_info) return web.json_response(queue_info)
@routes.get("/queue_summary")
async def get_queue_summary(request):
queue_info = {}
current_queue = self.prompt_queue.get_current_queue()
running_queue = current_queue[0]
running_ids = list()
for queue in running_queue:
prompt_id = queue[1]
running_ids.append(prompt_id)
running_info = {'prompt_id': prompt_id, 'current_node_id': self.last_node_id}
queue_info['running_status'] = running_info
pending_queue = current_queue[1]
pending_ids = list()
for queue in pending_queue:
pending_ids.append(queue[1])
queue_info['queue_running'] = running_ids
queue_info['queue_pending'] = pending_ids
return web.json_response(queue_info)
@routes.post("/prompt") @routes.post("/prompt")
async def post_prompt(request): async def post_prompt(request):
logging.info("got prompt") logging.info("got prompt")