MCPcopy
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / _execute_node

Method _execute_node

scrapegraphai/graphs/base_graph.py:198–220  ·  view source on GitHub ↗

Executes a single node and returns execution information.

(self, current_node, state, llm_model, llm_model_name)

Source from the content-addressed store, hash-verified

196 return None
197
198 def _execute_node(self, current_node, state, llm_model, llm_model_name):
199 """Executes a single node and returns execution information."""
200 curr_time = time.time()
201
202 with self.callback_manager.exclusive_get_callback(
203 llm_model, llm_model_name
204 ) as cb:
205 result = current_node.execute(state)
206 node_exec_time = time.time() - curr_time
207
208 cb_data = None
209 if cb is not None:
210 cb_data = {
211 "node_name": current_node.node_name,
212 "total_tokens": cb.total_tokens,
213 "prompt_tokens": cb.prompt_tokens,
214 "completion_tokens": cb.completion_tokens,
215 "successful_requests": cb.successful_requests,
216 "total_cost_USD": cb.total_cost,
217 "exec_time": node_exec_time,
218 }
219
220 return result, node_exec_time, cb_data
221
222 def _get_next_node(self, current_node, result):
223 """Determines the next node to execute based on current node type and result."""

Callers 1

_execute_standardMethod · 0.95

Calls 2

executeMethod · 0.45

Tested by

no test coverage detected