MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / __init__

Method __init__

eval_code/recons/models/moge/utils/pipeline.py:316–337  ·  view source on GitHub ↗

Initialize the pipeline with a list of nodes to execute sequentially. ### Parameters: - nodes: List of nodes or functions to execute sequentially. Generator functions are wrapped in provider nodes, and other functions are wrapped in worker nodes. - function_running_a

(self, nodes: List[Union[Node, Callable]], function_running_as: Literal['thread', 'process'] = 'thread', in_buffer_size: int = 1, out_buffer_size: int = 1)

Source from the content-addressed store, hash-verified

314 The order of input and output items is preserved (FIFO)
315 """
316 def __init__(self, nodes: List[Union[Node, Callable]], function_running_as: Literal['thread', 'process'] = 'thread', in_buffer_size: int = 1, out_buffer_size: int = 1):
317 """
318 Initialize the pipeline with a list of nodes to execute sequentially.
319 ### Parameters:
320 - nodes: List of nodes or functions to execute sequentially. Generator functions are wrapped in provider nodes, and other functions are wrapped in worker nodes.
321 - function_running_as: Whether to wrap the function as a thread or process worker. Defaults to 'thread'.
322 - in_buffer_size: Maximum size of the input queue of the pipeline. Defaults to 0 (unlimited).
323 - out_buffer_size: Maximum size of the output queue of the pipeline. Defaults to 0 (unlimited).
324 """
325 super().__init__(in_buffer_size, out_buffer_size)
326 for node in nodes:
327 if isinstance(node, Node):
328 pass
329 elif isinstance(node, Callable):
330 if inspect.isgeneratorfunction(node):
331 node = ProviderFunction(node, function_running_as)
332 else:
333 node = WorkerFunction(node, function_running_as)
334 else:
335 raise ValueError(f"Invalid node type: {type(node)}")
336 self.add(node)
337 self.chain([None, *self.nodes, None])
338
339
340class Parallel(Node):

Callers

nothing calls this directly

Calls 5

ProviderFunctionClass · 0.85
WorkerFunctionClass · 0.85
chainMethod · 0.80
__init__Method · 0.45
addMethod · 0.45

Tested by

no test coverage detected