MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / queue_reader

Function queue_reader

python/paddle/reader/decorator.py:689–715  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

687 raise e
688
689 def queue_reader():
690 queue = fork_context.Queue(queue_size)
691 for reader in readers:
692 p = fork_context.Process(
693 target=_read_into_queue, args=(reader, queue)
694 )
695 p.start()
696
697 reader_num = len(readers)
698 finish_num = 0
699 while finish_num < reader_num:
700 try:
701 sample = queue.get(timeout=QUEUE_GET_TIMEOUT)
702 except Exception as e:
703 logging.error(
704 "multiprocess_reader failed to get data from the multiprocessing.Queue."
705 )
706 raise e
707
708 if sample is None:
709 finish_num += 1
710 elif sample == "":
711 raise ValueError(
712 "multiprocess_reader failed to put data into the multiprocessing.Queue."
713 )
714 else:
715 yield sample
716
717 def _read_into_pipe(reader, conn):
718 try:

Callers

nothing calls this directly

Calls 5

ValueErrorClass · 0.85
ProcessMethod · 0.80
startMethod · 0.45
getMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected