()
| 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: |
nothing calls this directly
no test coverage detected