MCPcopy Create free account
hub / github.com/google-research/language / PreprocessingServicer

Class PreprocessingServicer

language/realm/preprocessing.py:34–52  ·  view source on GitHub ↗

A Preprocessing server.

Source from the content-addressed store, hash-verified

32
33
34class 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
55def create_and_start_server(port, servicer):

Callers 1

push_examplesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…