A Preprocessing server.
| 32 | |
| 33 | |
| 34 | class PreprocessingServicer(preprocessing_pb2_grpc.PreprocessingServicer): |
| 35 | """A Preprocessing server.""" |
| 36 | |
| 37 | def __init__(self, max_queue_size, *args, **kwargs): |
| 38 | super(PreprocessingServicer, self).__init__(*args, **kwargs) |
| 39 | self._queue = queue.Queue(maxsize=max_queue_size) |
| 40 | |
| 41 | def PopExample(self, request, context): |
| 42 | return self._queue.get() |
| 43 | |
| 44 | def PushExample(self, example, timeout): |
| 45 | try: |
| 46 | self._queue.put(example, timeout=timeout) |
| 47 | except queue.Full: |
| 48 | tf.logging.info("Failed to push example. Queue is full.") |
| 49 | return # Ignore |
| 50 | |
| 51 | def QueueSize(self): |
| 52 | return self._queue.qsize() |
| 53 | |
| 54 | |
| 55 | def create_and_start_server(port, servicer): |
no outgoing calls
no test coverage detected
searching dependent graphs…