MCPcopy Create free account
hub / github.com/Comfy-Org/ComfyUI / add_node

Method add_node

comfy_execution/graph.py:138–166  ·  view source on GitHub ↗
(self, node_unique_id, include_lazy=False, subgraph_nodes=None)

Source from the content-addressed store, hash-verified

136 self.blocking[from_node_id][to_node_id][from_socket] = True
137
138 def add_node(self, node_unique_id, include_lazy=False, subgraph_nodes=None):
139 node_ids = [node_unique_id]
140 links = []
141
142 while len(node_ids) > 0:
143 unique_id = node_ids.pop()
144 if unique_id in self.pendingNodes:
145 continue
146
147 self.pendingNodes[unique_id] = True
148 self.blockCount[unique_id] = 0
149 self.blocking[unique_id] = {}
150
151 inputs = self.dynprompt.get_node(unique_id)["inputs"]
152 for input_name in inputs:
153 value = inputs[input_name]
154 if is_link(value):
155 from_node_id, from_socket = value
156 if subgraph_nodes is not None and from_node_id not in subgraph_nodes:
157 continue
158 _, _, input_info = self.get_input_info(unique_id, input_name)
159 is_lazy = input_info is not None and "lazy" in input_info and input_info["lazy"]
160 if (include_lazy or not is_lazy):
161 if not self.is_cached(from_node_id):
162 node_ids.append(from_node_id)
163 links.append((from_node_id, from_socket, unique_id))
164
165 for link in links:
166 self.add_strong_link(*link)
167
168 def add_external_block(self, node_id):
169 assert node_id in self.blockCount, "Can't add external block to a node that isn't pending"

Callers 3

add_strong_linkMethod · 0.95
executeFunction · 0.80
execute_asyncMethod · 0.80

Calls 6

get_input_infoMethod · 0.95
is_cachedMethod · 0.95
add_strong_linkMethod · 0.95
is_linkFunction · 0.90
get_nodeMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected