Start threads for `QueueRunners`. Note that the queue runners collected in the graph key `QUEUE_RUNNERS` are already started automatically when you create a session with the supervisor, so unless you have non-collected queue runners to start you do not need to call this explicitly.
(self, sess, queue_runners=None)
| 745 | return sess |
| 746 | |
| 747 | def start_queue_runners(self, sess, queue_runners=None): |
| 748 | """Start threads for `QueueRunners`. |
| 749 | |
| 750 | Note that the queue runners collected in the graph key `QUEUE_RUNNERS` |
| 751 | are already started automatically when you create a session with the |
| 752 | supervisor, so unless you have non-collected queue runners to start |
| 753 | you do not need to call this explicitly. |
| 754 | |
| 755 | Args: |
| 756 | sess: A `Session`. |
| 757 | queue_runners: A list of `QueueRunners`. If not specified, we'll use the |
| 758 | list of queue runners gathered in the graph under the key |
| 759 | `GraphKeys.QUEUE_RUNNERS`. |
| 760 | |
| 761 | Returns: |
| 762 | The list of threads started for the `QueueRunners`. |
| 763 | |
| 764 | Raises: |
| 765 | RuntimeError: If called with eager execution enabled. |
| 766 | |
| 767 | @compatibility(eager) |
| 768 | Queues are not compatible with eager execution. To ingest data when eager |
| 769 | execution is enabled, use the `tf.data` API. |
| 770 | @end_compatibility |
| 771 | """ |
| 772 | if context.executing_eagerly(): |
| 773 | raise RuntimeError("Queues are not compatible with eager execution.") |
| 774 | if queue_runners is None: |
| 775 | queue_runners = self._graph.get_collection(ops.GraphKeys.QUEUE_RUNNERS) |
| 776 | threads = [] |
| 777 | for qr in queue_runners: |
| 778 | threads.extend( |
| 779 | qr.create_threads(sess, coord=self._coord, daemon=True, start=True)) |
| 780 | return threads |
| 781 | |
| 782 | def loop(self, timer_interval_secs, target, args=None, kwargs=None): |
| 783 | """Start a LooperThread that calls a function periodically. |