MCPcopy Create free account
hub / github.com/BabitMF/bmf / process

Method process

bmf/modules/c_module.py:254–287  ·  view source on GitHub ↗
(self, task=None)

Source from the content-addressed store, hash-verified

252 return r
253
254 def process(self, task=None):
255 # create c task
256 c_task = csdk.Task(c_module.to_str_array(task.get_inputs().keys()),
257 c_module.to_str_array(task.get_outputs().keys()))
258 c_task.set_timestamp(task.get_timestamp())
259
260 # convert python packet to c packet
261 # and add to c task queue
262 for (label, queue) in task.get_inputs().items():
263 while not queue.empty():
264 py_pkt = queue.get()
265 c_pkt = self.python_packet_to_c_packet(py_pkt)
266 if c_pkt is not None and c_pkt.defined():
267 c_task.add_packet_to_in_queue(str(label), c_pkt)
268 Log.log_node(LogLevel.ERROR, task.node_, "push frame",
269 c_pkt.py_get_data())
270
271 # call process of c module
272 self.c_mod_.process(c_task)
273 task.set_timestamp(c_task.get_timestamp())
274
275 # get c output packets, convert to python packet
276 # and add to python output queue
277 for (label, queue) in task.get_outputs().items():
278 while c_task.is_out_queue_empty(str(label)) == 0:
279 c_pkt = csdk.Packet()
280 c_task.pop_packet_from_out_queue(str(label), c_pkt)
281 py_pkt = self.c_packet_to_python_packet(c_pkt)
282 if py_pkt is not None and py_pkt.defined():
283 queue.put(py_pkt)
284 Log.log_node(LogLevel.ERROR, task.node_, "pull frame",
285 py_pkt.get_data())
286
287 return ProcessResult.OK

Callers

nothing calls this directly

Calls 11

set_timestampMethod · 0.95
TaskMethod · 0.80
to_str_arrayMethod · 0.80
log_nodeMethod · 0.80
putMethod · 0.80
emptyMethod · 0.45
getMethod · 0.45
definedMethod · 0.45

Tested by

no test coverage detected