From 89621e290c57c4a729d04927293000d22a7df525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E9=9B=AA=E5=B3=B0?= Date: Thu, 15 May 2025 15:05:26 +0800 Subject: [PATCH] fix: running again not be executed ndoe FilterSortDependSubGraphs and SortDependSubGraphs after occur error --- README.md | 4 +++- easyapi/UtilNode.py | 38 +++++++++++--------------------------- pyproject.toml | 2 +- 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 9bb63cc..084cc3f 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,9 @@ Tips: base64格式字符串比较长,会导致界面卡顿,接口请求带 ![批量裁剪打标](example/example_image_crop_tag.png) ## 更新记录 -### 2025-03-28 (v1.1.4) +### 2025-05-15 (v1.1.5) +- Fix: FilterSortDependSubGraphs和SortDependSubGraphs前置节点运行异常后,再次提交任务,前置节点没有被执行 +### 2025-05-12 (v1.1.4) - 新增节点 NoneNode ### 2025-03-28 (v1.1.3) - 新增配置项 `allow_create_dir_when_save` 控制保存文本和图像时是否自动创建目录 diff --git a/easyapi/UtilNode.py b/easyapi/UtilNode.py index 0d005bb..c7a9d20 100644 --- a/easyapi/UtilNode.py +++ b/easyapi/UtilNode.py @@ -787,7 +787,7 @@ class NoneNode: RETURN_NAMES = ("none",) FUNCTION = "execute" CATEGORY = "EasyApi/Utils" - DESCRIPTION = "判断输入是否为None、空列表、空字符串(trim后判断)、空字典" + DESCRIPTION = "空节点" def execute(self): return None, @@ -1100,9 +1100,6 @@ class TryFreeMemory: NUM_FLOW_SOCKETS = 20 class FilterSortDependSubGraphs: - def __init__(self): - self.count = 0 - @classmethod def INPUT_TYPES(cls): return { @@ -1124,7 +1121,6 @@ class FilterSortDependSubGraphs: "如:配置filter_sort为1,4,3 表示按 depend_1 => depend_4 => depend_3 依次执行, 而depend_2不会被执行。") def sort_graph(self, filter_sort, **kwargs): - self.count = 0 max_num = find_max_suffix_number(kwargs, "depend_") indexes = [int(item.strip()) for item in filter_sort.split(",") if len(item.strip()) > 0] @@ -1134,22 +1130,14 @@ class FilterSortDependSubGraphs: def check_lazy_status(self, filter_sort, **kwargs): if filter_sort and len(filter_sort.strip()) > 0: indexes = [int(item.strip()) for item in filter_sort.split(",") if "depend_%d" % int(item.strip()) in kwargs.keys()] - for i in indexes: - if self.count < len(indexes): - index = indexes[self.count] - input_name = "depend_%d" % index - self.count += 1 - if kwargs.get(input_name, None) is None: - # 找到没有缓存的输入项,解决靠后的依赖节点变化后没有被执行的问题 - return [input_name] - else: - break + for index in indexes: + input_name = "depend_%d" % index + if kwargs.get(input_name, None) is None: + # 找到没有缓存的输入项,解决靠后的依赖节点变化后没有被执行的问题 + return [input_name] class SortDependSubGraphs: - def __init__(self): - self.count = 0 - @classmethod def INPUT_TYPES(cls): return { @@ -1171,7 +1159,6 @@ class SortDependSubGraphs: "\n如:配置sort为1,4 表示先按 depend_1 => depend_4 依次执行, 而depend_3和depend_2按默认顺序执行。") def sort_graph(self, sort, **kwargs): - self.count = 0 max_num = find_max_suffix_number(kwargs, "depend_") outputs = [kwargs.get("depend_%d" % i, None) for i in range(1, max_num + 1)] @@ -1180,14 +1167,11 @@ class SortDependSubGraphs: def check_lazy_status(self, sort, **kwargs): if sort and len(sort.strip()) > 0: indexes = [int(item.strip()) for item in sort.split(",") if "depend_%d" % int(item.strip()) in kwargs.keys()] - for i in indexes: - if self.count < len(indexes): - index = indexes[self.count] - input_name = "depend_%d" % index - self.count += 1 - if kwargs.get(input_name, None) is None: - # 找到没有缓存的输入项,解决靠后的依赖节点变化后没有被执行的问题 - return [input_name] + for index in indexes: + input_name = "depend_%d" % index + if kwargs.get(input_name, None) is None: + # 找到没有缓存的输入项,解决靠后的依赖节点变化后没有被执行的问题 + return [input_name] max_num = find_max_suffix_number(kwargs, "depend_") return ["depend_%d" % j for j in range(1, max_num + 1) if j not in indexes and "depend_%d" % j in kwargs.keys() and kwargs.get("depend_%d" % j, None) is None] diff --git a/pyproject.toml b/pyproject.toml index e0ac15a..1969fa3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-easyapi-nodes" description = "Provides some features and nodes related to API calls. 开发独立应用调用ComfyUI服务的一些补充节点。" -version = "1.1.4" +version = "1.1.5" license = { file = "LICENSE" } dependencies = ["segment_anything", "simple_lama_inpainting", "insightface", "simplejson", "pycocotools"]