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

Class Node

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

Source from the content-addressed store, hash-verified

72 raise Terminate()
73
74class Node:
75 def __init__(self, in_buffer_size: int = 1, out_buffer_size: int = 1) -> None:
76 self.input: Queue = Queue(maxsize=in_buffer_size)
77 self.output: Queue = Queue(maxsize=out_buffer_size)
78 self.in_buffer_size = in_buffer_size
79 self.out_buffer_size = out_buffer_size
80
81 @abstractmethod
82 def start(self):
83 pass
84
85 @abstractmethod
86 def terminate(self):
87 pass
88
89 def stop(self):
90 self.terminate()
91 self.join()
92
93 @abstractmethod
94 def join(self):
95 pass
96
97 def put(self, data: Any, key: str = None, block: bool = True) -> None:
98 item = _ItemWrapper(data)
99 self.input.put(item, block=block)
100
101 def get(self, key: str = None, block: bool = True) -> Any:
102 item: _ItemWrapper = self.output.get(block=block)
103 return item.data
104
105 def __enter__(self):
106 self.start()
107 return self
108
109 def __exit__(self, exc_type, exc_value, traceback):
110 self.terminate()
111 self.join()
112
113
114class ConcurrentNode(Node):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected